10035 network error

Asked by JR

Hello Roger,

I am writing a small program using Mosquitto.

I get a lot of 10035 socket error messages causing a disconnect. According to Microsoft this is a nonfatal error (http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx)

I added some extra debug code to Mosquitto.py and noticed that the error is always caused at the following method:

def _packet_read(self):

I've added the following piece of code (hack) to it:

if msg.errno == 10035
    return MOSQ_ERR_SUCCESS

This causes the Mosquitto object to keep working. I've tested it for a while (on my system, win 7 32 bit, python 2.7) and noticed that my program works ok and without strange disconnects. What I also noticed is that the error usually occurs around 10 times in a row.

I don't know if I am the only one experiencing this problem and it's worth more investigating but I thought it was worth sharing it :)

Cheers and keep up the good work!!

JR

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Roger Light
Solved:
Last query:
Last reply:
Revision history for this message
Best Roger Light (roger.light) said :
#1

It's a bit annoying that Python doesn't handle this platform specific
difference. You should actually change "if msg.errno == errno.EAGAIN:"
to "if msg.errno == errno.WSAEGAIN:" to fix it for Windows. I'll get a
more portable fix committed soon.

Thanks for reporting this!

On Tue, Aug 13, 2013 at 8:26 PM, JR
<email address hidden> wrote:
> New question #233973 on mosquitto:
> https://answers.launchpad.net/mosquitto/+question/233973
>
> Hello Roger,
>
> I am writing a small program using Mosquitto.
>
> I get a lot of 10035 socket error messages causing a disconnect. According to Microsoft this is a nonfatal error (http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx)
>
> I added some extra debug code to Mosquitto.py and noticed that the error is always caused at the following method:
>
> def _packet_read(self):
>
> I've added the following piece of code (hack) to it:
>
> if msg.errno == 10035
> return MOSQ_ERR_SUCCESS
>
> This causes the Mosquitto object to keep working. I've tested it for a while (on my system, win 7 32 bit, python 2.7) and noticed that my program works ok and without strange disconnects. What I also noticed is that the error usually occurs around 10 times in a row.
>
> I don't know if I am the only one experiencing this problem and it's worth more investigating but I thought it was worth sharing it :)
>
> Cheers and keep up the good work!!
>
> JR
>
>
>
>
>
> --
> You received this question notification because you are a member of
> Mosquitto PPA, which is an answer contact for mosquitto.

Revision history for this message
JR (zaalberg-jeroen) said :
#2

Thanks for the fast reply.

I have been tracking the cause of this sudden disconnect's for some time now :)

I am writing a program to live stream 2 webcams (wireless) using MQTT (as part of a application) so it's really stressing the broker :) Using the fix it works great!

Anyway, glad I could help.

Cheers.

Revision history for this message
JR (zaalberg-jeroen) said :
#3

Thanks Roger Light, that solved my question.

Revision history for this message
Flo Rian (o-launchpad-info) said :
#4

Hi Roger and JR
I've tried the fix suggested by Roger but there is no errno.WSAEGAIN in python 2.7.2 so I've just used 10035 and it seems to work so far.
I've also had this problem for a while and just used QOS 0 for testing but I am glad I can use QOS>0 this way.
Cheers
Flo

Revision history for this message
Roger Light (roger.light) said :
#5

Hi Flo,

Thanks for the extra information. I'll just be using WSAEAGAIN in the upcoming 1.2.1 bugfix release - Python 2.7.2 is two years old now and there are more recent 2.7.x releases that do work. This answers thread will remain for anybody who can't upgrade and is looking for the solution.

Revision history for this message
Flo Rian (o-launchpad-info) said :
#6

Hi Roger,
ok I agree 2.7.2 is old, upgraded to python 2.7.5:
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
If I do:
import errno
for v in dir(errno):
     if 'AGAIN' in v:
         print v
gives:
EAGAIN
and if I try
errno.WSAEAGAIN
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'WSAEAGAIN'

Revision history for this message
Roger Light (roger.light) said :
#7

Er, yes. It's actually errno.WSAEWOULDBLOCK. I'm not sure where I saw WSAEAGAIN in Python...