Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMiteWEB V5.07.07a24+ - Now with TFTP
Page 2 of 5 | |||||
Author | Message | ||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6103 |
I spoke too soon: Connected *** PANIC *** Out of Heap memo After 15 reports. JIm VK7JH MMedit MMBasic Help |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
Thanks Jim. I will try your proposal after my ongoing test is done. What about the buff%()? Should it be emptied between the updates? I suppose not. |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
Tested with updating only one location every second minute. Crashed after 15 updates. Checked openweathermap and it allows 60 calls per minute; so that should not be a problem. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
We need to narrow down the cause. If you write a simple json parser in Basic rather than using the json$ function does that fix it? json$() uses the system heap. It is third party code and is supposed to clean up after itself but who knows |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
Tested with DIM buff%(1024) and updates each 15s to save time. PANIC after 15 updates. |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1245 |
FYI: I also had a ***Panic*** error message when using JSON (V5.07.07a16). But only with certain JSON data from Openweathermap (which I don't want to pass on unedited because of ID). I'm pretty sure it's a JSON issue. I will test it again on the CMM2. Regards Michael causality ≠ correlation ≠ coincidence |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
The CMM2 is very different. It uses MMBasic heap rather than system heap and cleans up regardless after each call so the two aren't comparable. The PicoMite can't do the same thing. |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
Yes it seems to be a JSON issue. I removed all JSON statements and just retrieved the the data. Updating did not stop (no PANIC). Printed the buff%(); looks like this: RUN ntp address 195.148.70.12 got ntp response: 14/03/2023 12:51:22 ****************Update nbr: 1 tcp address 188.166.16.132 Connected 488 2478231517896319611 4189032028242606906 3184384918481155378 3474028082218757154 2462480755104232238 2482157843938108791 4189021006120835898 7593470440261300280 8462101260445295214 8315162384941609828 ........ etc |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6103 |
I added this (and the memory command) Print "Heap: ";Hex$(MM.Info(stack)),MM.Info(HEAP) Heap: 200413E8 78080 Heap and memory didn't change. Still crashed after 15 calls. Jim VK7JH MMedit MMBasic Help |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
I think I may have found something. Are you parsing something that comes back as an empty string? This can happen if it is an array (rather an array element) or some other things in json I don't understand (raw, object , null) If you are then there is a possible memory leak which will eventually cause the issue. If so I can then probably fix it. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Try it without this TEXT 0,120,"Regn: "+Json$(buff%(),"rain.1h")+" mm/h" You can see the returned data with and you will see that rain.1h doesn't exist. I should be protecting against this error but I think this is the problem |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
In fact I removed it just before your message! |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
V5.07.07a25 PicoMiteWebV5.07.07a25.zip Fixes memory leak in json$ function if the naughty user requests a field that doesn't exist |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
Naughty user send big THANKS to Peter, Jim & TwoFingers! 22 updates now and no PANIC. Will now go over to a25. |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1245 |
Btw. I think there are still (crash) problems with A25. Not associated with JSON. I test ... Some OT for Openweathermap: ' Windrose converts a degree cardinal direction into a compass direction. Degree=360-11 Print Degree, windrose16$(Degree) End Function windrose16$(Degree) Local WD$(16)=("NNO","NO","ONO","O","OSO","SO","SSO","S","SSW","SW","WSW","W", "WNW","NW","NNW","N","NNO") windrose16$=WD$(Int(((Degree+360*(Degree<11.25))-11.25)/22.5)) End Function causality ≠ correlation ≠ coincidence |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Didn't crash for me |
||||
Michal Senior Member Joined: 02/02/2022 Location: PolandPosts: 123 |
In: "Windows MMBasic Version 5.07.03b15 ... 349 Error in line 8: Expected closing bracket" Michal |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1245 |
@Peter Please try this: MFile$="ABC" path$=".\nsa8\"+MFile$ End For me it causes a crash. Michael Edit: Works: a$="test"+"TEST" End Crashes: a$="\"+"test" 'crash End Edited 2023-03-15 02:32 by twofingers causality ≠ correlation ≠ coincidence |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 722 |
Commit: MFile$="ABC" > path$=".\nsa8\"+MFile$ CRASH RESET > > print mm.ver 5.070723 > |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3816 |
Now that \ starts an escape you need to change the strings. (Ideally it wouldn't crash, though.) John |
||||
Page 2 of 5 |
Print this page |