Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Exception: 'NoneType' object has no attribute 'recv'

Hi Roger,

I can't find anything about threaded_set() in the python lib?
Why I'm calling loop_forever in a thread is a long story :)

Essential I am hosting a number of "plugins" in a single process. So for the MQTT listener plugin it is structured as if it was on the main thread (but its not) as most of the plugins block while they are running.
I actually could use loop_start if thats the issue.

Adam



Date: Mon, 9 Nov 2015 23:32:40 +0000
From: Roger Light <roger@xxxxxxxxxx>
To: General development discussions for paho project
        <paho-dev@xxxxxxxxxxx>
Subject: Re: [paho-dev] Exception: 'NoneType' object has no attribute
        'recv'
Message-ID:
        <CAH7zdyf81Lyct3Yy7q_osdH3FTJHqFUP38yEDesh19tg8pi8bQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

Hi Adam,

Just a brief reply because it is late.

Did you use threaded_set() to indicate you are using threads? The client
optimises the single threaded case in a way that breaks if you are actually
using threads. Loop_start deals with it on its own.

Out of curiosity, what advantage do you get calling loop forever in a
thread that loop start doesn't give you?

Cheers,

Roger
On Nov 9, 2015 11:14 PM, "Adam Mills" <adam@xxxxxxxxxxxxx> wrote:

> ?
> Hi roger,
>
> I am using client.loop_forever in a Thread
> I am also using SSL, Is it odd that I'm hitting that line and not the SSL
> one above it?
> I have gone to exiting and using my supervisor to restart
>
> Thanks
> Adam
>
>
>> Date: Mon, 9 Nov 2015 21:22:17 +0000
>> From: Roger Light <roger@xxxxxxxxxx>
>> To: General development discussions for paho project
>>         <paho-dev@xxxxxxxxxxx>
>> Subject: Re: [paho-dev] Exception: 'NoneType' object has no attribute
>>         'recv'
>> Message-ID:
>>         <CAH7zdyfr4Md25d2XV8=
>> rasY8nV+w6ySnR0fEqX4v36PNNEk11g@xxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi Adam,
>>
>> The error you have suggests that your connection is dropping and that is
>> then causing the error in packet_read. It's a bug that that code isn't
>> checking self._sock first.
>>
>> Are you using client.loop_forever() directly, or client.loop_start()
>> instead? And are you using threads?
>>
>> Cheers,
>>
>> Roger
>>
>>
>> On Mon, Nov 9, 2015 at 1:13 AM, Adam Mills <adam@xxxxxxxxxxxxx> wrote:
>>
>> > Under certain circumstances I get the following exception in
>> loop_forever
>> > I then disconnect, re-create the client and connect and again.
>> > However, it seems the old connection is maintained as i get the constant
>> > Connecting/disconnecting that is symptomatic of multiple connections
>> with
>> > the same clientid
>> >
>> > Unfortunately I can't get the exception to happen locally.
>> > It's running on Python 2.7.3 (OpenWRT)
>> >
>> > Is there any better way to restart after this error?
>> >
>> >
>> > Exception: 'NoneType' object has no attribute 'recv'
>> >
>> >  self.client.loop_forever(retry_first_connection=True)
>> >   File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line
>> 1261, in loop_forever
>> >     rc = self.loop(timeout, max_packets)
>> >   File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line
>> 811, in loop
>> >     rc = self.loop_read(max_packets)
>> >   File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line
>> 1073, in loop_read
>> >     rc = self._packet_read()
>> >   File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line
>> 1407, in _packet_read
>> >     command = self._sock.recv(1)"
>> >
>> > ?
>> >
>> > _______________________________________________
>> > paho-dev mailing list
>> > paho-dev@xxxxxxxxxxx
>> > To change your delivery options, retrieve your password, or unsubscribe
>> > from this list, visit
>> > https://dev.eclipse.org/mailman/listinfo/paho-dev
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <
>> https://dev.eclipse.org/mailman/private/paho-dev/attachments/20151109/6f08ba06/attachment.html
>> >
>>
>
> _______________________________________________
> paho-dev mailing list
> paho-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/paho-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/paho-dev/attachments/20151109/c8f2b078/attachment.html>

------------------------------

Back to the top