mosquitto-users team mailing list archive
-
mosquitto-users team
-
Mailing list archive
-
Message #00190
Re: Exception thrown from loop() when ssl enabled and network missing
I'm attaching an example. You'll need to fill in all the "yourdatahere"
strings to run it. It establishes a connection and then reconnects after
every five loops. To repro the crash, let it connect, and then turn off
your network connection during the loops. When the next reconnect is
attempted, loop will throw like this:
Traceback (most recent call last):
File "./repro.py", line 57, in <module>
my_loop_forever()
File "./repro.py", line 23, in my_loop_forever
rc = _client.loop()
File "/home/jacko/linuxmessenger/mosquitto.py", line 670, in loop
rc = self.loop_read(max_packets)
File "/home/jacko/linuxmessenger/mosquitto.py", line 840, in loop_read
rc = self._packet_read()
File "/home/jacko/linuxmessenger/mosquitto.py", line 1078, in _packet_read
command = self._ssl.read(1)
File "/usr/lib/python3.2/ssl.py", line 295, in read
v = self._sslobj.read(len or 1024)
I've also seen connect() throw, but I don't remember how to repro it.
On Sat, Feb 23, 2013 at 3:42 AM, Roger Light <roger@xxxxxxxxxx> wrote:
> Hi Jack,
>
> Have you got an example program that reproduces this problem? I've
> managed to get a similar error but wondered how you were doing it.
>
> Cheers,
>
> Roger
>
> On Sun, Feb 17, 2013 at 7:38 PM, Jack O'Connor <oconnor663@xxxxxxxxx>
> wrote:
> > Traceback (most recent call last):
> > File "/usr/lib/python3.2/threading.py", line 740, in _bootstrap_inner
> > self.run()
> > File "/usr/lib/python3.2/threading.py", line 693, in run
> > self._target(*self._args, **self._kwargs)
> > File "/home/jacko/linuxmessenger/mosquitto.py", line 1765, in
> _thread_main
> > rc = self.loop()
> > File "/home/jacko/linuxmessenger/mosquitto.py", line 670, in loop
> > rc = self.loop_read(max_packets)
> > File "/home/jacko/linuxmessenger/mosquitto.py", line 840, in loop_read
> > rc = self._packet_read()
> > File "/home/jacko/linuxmessenger/mosquitto.py", line 1078, in
> _packet_read
> > command = self._ssl.read(1)
> > File "/usr/lib/python3.2/ssl.py", line 295, in read
> > v = self._sslobj.read(len or 1024)
> > AttributeError: 'NoneType' object has no attribute 'read'
> >
> > It looks like _packet_read() catches certain socket exceptions, but it
> > doesn't expect this one. I'm guessing this is a behavior difference
> between
> > ssl and non-ssl sockets. Is this a bug?
> >
> > --
> > Mailing list: https://launchpad.net/~mosquitto-users
> > Post to : mosquitto-users@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~mosquitto-users
> > More help : https://help.launchpad.net/ListHelp
> >
>
Attachment:
repro.py
Description: Binary data
Follow ups
References