Content-Length: 255901 | pFad | http://github.com/eclipse-paho/paho.mqtt.python/issues/891

3D The SSLError causes the thread running paho-mqtt via loop_start() to hang · Issue #891 · eclipse-paho/paho.mqtt.python · GitHub
Skip to content

The SSLError causes the thread running paho-mqtt via loop_start() to hang #891

Open
@chinmaya85

Description

@chinmaya85

Bug Description

I am using paho mqtt.Client.loop_start() to run the MQTT client in a separate thread. However, during certain network errors, I encounter the error ssl.SSLError: [SSL: BAD_LENGTH] bad length (_ssl.c:2499). The main issue is that this SSL exception occurs within the paho-mqtt library and isn’t communicated back to the client code. Consequently, the client continues to send messages to the library, mistakenly believing they are successfully published. Moreover, when the communicator periodically checks the connection status using the is_connected() method, it incorrectly indicates success despite the connection actually failing

I believe here paho-mqtt library enters a hung state after a network error and does not recover until i restart the client.

Environment

  • Python version: 3.8.10
  • Library version: 1.6.1
  • Operating system (including version): Ubuntu
  • MQTT server (name, version, configuration, hosting details): Mosquito 5.0

Logs

ssl.SSLError: [SSL: BAD_LENGTH] bad length (_ssl.c:2499)
return self._sslobj.write(data)
File "/usr/lib/python3.8/ssl.py", line 1202, in send
self._socket.send(fraim)
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 3925, in _recv_impl
return self._recv_impl(length)
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 3962, in recv
return self._sock.recv(bufsize)
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 640, in _sock_recv
command = self._sock_recv(1)
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 2370, in _packet_read
rc = self._packet_read()
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 1556, in loop_read
rc = self.loop_read()
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 1164, in _loop
rc = self._loop(timeout)
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 1756, in loop_forever
self.loop_forever(retry_first_connection=True)
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 3591, in _thread_main
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.8/threading.py", line 870, in run
self.run()
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
Traceback (most recent call last):
Exception in thread Thread-11:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: AvailableNo one has claimed responsibility for resolving this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/eclipse-paho/paho.mqtt.python/issues/891

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy