bug: Assertion error raised due to _reauthorize not running in pipeline thread
See original GitHub issueContext
-
OS and version used: Windows 10
-
Python version: 3.9.7
-
pip version: 21.2.3
-
list of installed packages: attrs==21.2.0 azure-core==1.21.1 azure-iot-device==2.9.0 azure-storage-blob==12.9.0 backcall==0.2.0 certifi==2021.10.8 cffi==1.15.0 charset-normalizer==2.0.9 colorama==0.4.4 cryptography==36.0.0 decorator==5.1.0 deprecation==2.1.0 idna==3.3 ipython==7.30.1 isodate==0.6.0 janus==0.7.0 jedi==0.18.1 jsonschema==4.2.1 matplotlib-inline==0.1.3 msrest==0.6.21 oauthlib==3.1.1 packaging==21.3 paho-mqtt==1.6.1 parso==0.8.3 pickleshare==0.7.5 prompt-toolkit==3.0.24 pycparser==2.21 pydantic==1.8.2 Pygments==2.10.0 pyparsing==3.0.6 pyrsistent==0.18.0 PySocks==1.7.1 PyYAML==6.0 requests==2.26.0 requests-oauthlib==1.3.0 requests-unixsocket==0.2.0 six==1.16.0 traitlets==5.1.1 typing_extensions==4.0.1 urllib3==1.26.7 wcwidth==0.2.5
Description of the issue
When running the receive direct method sample code for a long time (i.e. >24 h), the code raises an assertion error that the function _reauthorize
is not running inside a pipeline thread. As a result, the device can no longer receive direct methods, but the main thread does not crash, so it’s not possible to know when this error has occurred apart from looking at the logs. A similar error has been mentioned in the below link:
https://docs.microsoft.com/en-us/answers/questions/679775/iot-device-assertion-error-freezing-iot-device.html
Code sample exhibiting the issue
See above Azure IoT Device code sample
Console log of the issue
File "C:\...\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\...\Python39\lib\threading.py", line 1286 in run
self.function(*self.args, **self.kwargs)
File "C:\...\venv\lib\site-packages\azure\iot\device\common\pipeline\pipeline_stages_base.py", line 523, in retry_authorize
this.reuthorize()
File "C:\...\venv\lib\site-packages\azure\iot\device\common\pipeline\pipeline_thread.py", line 192, in wrapper
assert(
AssertionError:
Function _reauthorize is not running inside pipeline thread. It should be.
You should use invoke_on_pipeline_thread(_nowait) to enter the pipeline
thread before calling this function. If you're hitting this from inside a test
function, you may need to add the fake_pipeline_thread fixture to your
test. (generally applied on the global pytestmark in a module).
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
@ismailuddin This fix has been released as of the latest release, 2.10.0
This fix will be being released later this week as part of version 2.10.0