Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: release unlocked lock during running Dab Compliance suite when client lost network and reconnects #63

Open
panpakr opened this issue Jan 21, 2025 · 0 comments

Comments

@panpakr
Copy link

panpakr commented Jan 21, 2025

Hi ,

I have experienced one issue in running dab compliance on the client device which connects after wifi failure .
I have added few log in dab_client.py to check

Testing on message Lock : <unlocked _thread.lock object at 0x7f17fd8172a0> Self : <dab_client.DabClient object at 0x7f17fd817310> Client: <paho.mqtt.client.Client object at 0x7f17fd8170a0>
Lock is False
Reponse {'status': 200}
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
self.loop_forever(retry_first_connection=True)
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
rc = self._loop(timeout)
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1164, in _loop
rc = self.loop_read()
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1556, in loop_read
rc = self._packet_read()
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
rc = self._packet_handle()
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
return self._handle_publish()
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
self._handle_on_message(message)
File "/home/pkumar/.local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
on_message(self, self._userdata, message)
File "/media/pkumar/SSD/DAB/latest_dab/dab-compliance-suite/dab_client.py", line 20, in __on_message
self.__lock.release()
RuntimeError: release unlocked lock
App started?(Y/N)

As for log traces I found self.__lock.release() is called mulitple times

def __on_message(self, client, userdata, message):   
    self.__response_dic = json.loads(message.payload)
    self.__lock.release()
    try:
        self.__code = self.__response_dic['status']
    except:
        self.__code = -1

Is this a known issue from DAB suite or Paho Mqtt client library ?

I have tried like this ,but it spawn another issue in Dab Compliance
if(self.__lock.locked()):
self.__lock.release()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant