question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Assertion error raised due to _reauthorize not running in pipeline thread

See original GitHub issue

Context

  • 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

  • cloned repo: https://github.com/Azure/azure-iot-sdk-python/blob/main/azure-iot-device/samples/sync-samples/receive_direct_method.py

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:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
cartertinneycommented, Feb 14, 2022

@ismailuddin This fix has been released as of the latest release, 2.10.0

1reaction
cartertinneycommented, Feb 14, 2022

This fix will be being released later this week as part of version 2.10.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

AssertionError with list comprehension and loop #3289 - GitHub
The reason this fails in a seemingly poor manner under standard @jit is that this is a) a bug b) a bug that...
Read more >
Gitlab CI-CD Pipeline throws pytest Assertion error
We have a python repo hosted on Gitlab.com with a pipeline ... an error immediately at the pytest statement, before executing any tests:...
Read more >
Exception in thread "main" java.lang.AssertionError
It's a bug in the compiler because the class com.sun.tools.javac.util.Assert.error clearly says it's from javac , the Java compiler, ...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild. ... Bug:77 - "GnuCash Will not run after merge" status:RESOLVED resolution:FIXED severity:major · Bug:78...
Read more >
The dangers of assert in Python - Snyk
There are many ways to find bugs in Python code: the built-in debugger (pdb), ... line 1, in <module> AssertionError: Values do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found