You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the git version of picoweb running on an ESP32. Everything works smoothly. I do have a second ESP32 which posts data every 6 minutes to the "server". Everything looks good.
However, over time the "server" is showing less and less memory available. I've printed some debug messages with gc.mem_free().
This comes to a point where the server is not responding anymore. If you use telnet to connect to port 80 of the ESP "server" the connection is closed instantly again. No debug messages, no error messages.
There are still around 27000 bytes left of memory, so it's not that low.
I do have other functions running with uasyncio.create_task. The interesting fact is, that the server is not eating any memory if here is no web-interaction. If it just run the internal routines everything is fine and runs forever, but as soon as I start frequent server communication things are getting worse.
The function that is called frequently by the server is this:
def web_batteryslave(req, resp):
gc.collect()
print('%%% Web Start: Free Memory: ', gc.mem_free())
method = req.method
if req.method == "POST":
size = int(req.headers[b"Content-Length"])
data = yield from req.reader.read(size)
#print('$$$ Data: ', data)
try:
decoded = ujson.loads(str(data)[2:-1])
yield from picoweb.start_response(resp)
yield from resp.awrite("OK")
yield from resp.awrite("\r\n")
thisId = decoded['id'];
# Save data from this sensor to measurements
toolbox.measurements[thisId] = decoded
print('%%% WEB End: Free Memory: ', gc.mem_free())
return
except:
yield from picoweb.start_response(resp)
yield from resp.awrite("NOK")
yield from resp.awrite("\r\n")
The data in 'toolbox.measurements' is "just" updated every time, there is no new data added. The same functionality with storing the data works fine with local sensors without an memory leaks.
I've see other issues here and the discussion if the connection needs to be closed or not.
So how can this be debugged?
The text was updated successfully, but these errors were encountered:
Default target for the Pycopy project in general, and Picoweb in particular, is Unix port of Pycopy. All claims of something working or not working should be verified against the latest version of the Unix port. All versions of the components involved in testing should be provided, together with step by step reproduction instructions. Thanks.
Hi,
I'm using the git version of picoweb running on an ESP32. Everything works smoothly. I do have a second ESP32 which posts data every 6 minutes to the "server". Everything looks good.
However, over time the "server" is showing less and less memory available. I've printed some debug messages with gc.mem_free().
This comes to a point where the server is not responding anymore. If you use telnet to connect to port 80 of the ESP "server" the connection is closed instantly again. No debug messages, no error messages.
There are still around 27000 bytes left of memory, so it's not that low.
I do have other functions running with uasyncio.create_task. The interesting fact is, that the server is not eating any memory if here is no web-interaction. If it just run the internal routines everything is fine and runs forever, but as soon as I start frequent server communication things are getting worse.
The function that is called frequently by the server is this:
The data in 'toolbox.measurements' is "just" updated every time, there is no new data added. The same functionality with storing the data works fine with local sensors without an memory leaks.
I've see other issues here and the discussion if the connection needs to be closed or not.
So how can this be debugged?
The text was updated successfully, but these errors were encountered: