OSError: [Errno -1] ERR_MEM
-
@robert-hh interesting. I am getting this occasionally when using umqtt.simple to communicate with Losant with TLS. (Despite this umqtt.simple turns out to be more reliable than the underlying AWS Mqtt code).
I am monitoring memory continuously, so it would seem , in my case it is not a system memory issue (2,500,000 bytes free - am I looking at gc.mem_free ) . It would seem this
"return ERR_MEM if the length of the data exceeds the current send buffer size or if the length of the queue of outgoing segment is larger than the upper limit defined in lwipopts.h. The number of bytes available in the output queue can be retrieved with the tcp_sndbuf() function."could well be the culprit. Will investigate this further.Thanks for providing things.
-
i also get this problem with mqtt.
i'm getting this error quite often especially when i send nothing for a long time. but only check for mesagesdef wait_msg(self): res = self.sock.read(1) self.sock.setblocking(True) if res is None: return None if res == b"": raise OSError(-1) if res == b"\xd0": # PINGRESP sz = self.sock.read(1)[0] assert sz == 0 return Nonei found the piece of code where the error occurs but don't know precise what is going wrong. it looks like no response from the server to me.
it should just try again if you ask me -
@Eric-Waai Yes, you are right. I've bypassed this case by removing following part of the code:
if res == b"": raise OSError(-1) -
@milan
do you have any idea what is the reason of this problem.i did some testing yesterday, if i don't send anything via mqtt but do check for messages it crashes every time after 5 minutes and 16 seconds.
-
@Eric-Waai You may find that the remote connection is being closed. You may need to explicitly perform an mqtt Ping to keep the connection alive.
-
@timh
thanks it looks like that is the case.
i added a ping every now and then and it's still goingi prefer this before removing errors.
if the error still occurs i maybe remove it but for now it staysedit: still weird. i assumed that check_msg would be sufficient to keep the connection alive
-
@Eric-Waai thats what I found, check_msg only looks to see if any data is there in the socket. I have found that a lot of MQTT services, require a ping, or some other activity to keep the session alive. Otherwise their own inactivity timeout kicks in.
-
Somewhere in my main loop i am checking connected state (which tries pinging) and causes a reconnect if it drops out. This has worked out to be robust.
-
@timh
thanks for the help,with pinging in between it is much more stable, it still sometimes gives the same error, i'm gonna build something similar as you have, the error at this point gives me at least an idea where it goes wrong. if i remove it some other things might go wrong
-
@Eric-Waai said in OSError: [Errno -1] ERR_MEM:
i also get this problem with mqtt.
i'm getting this error quite often especially when i send nothing for a long time. but only check for mesagesdef wait_msg(self): res = self.sock.read(1) self.sock.setblocking(True) if res is None: return None if res == b"": raise OSError(-1) if res == b"\xd0": # PINGRESP sz = self.sock.read(1)[0] assert sz == 0 return Nonei found the piece of code where the error occurs but don't know precise what is going wrong. it looks like no response from the server to me.
it should just try again if you ask meAny solution to this so far?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login