The library is not thread-safe
See original GitHub issue self_sign_pem_chain = await get_event_loop().run_in_executor(
File "/usr/lib64/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.9/site-packages/ideco_crypto/cert.py", line 261, in get_selfgenerated_chain
common_name = _normalize_domain(common_name, allow_underscore=allow_underscore)
File "/usr/lib/python3.9/site-packages/ideco_crypto/cert.py", line 76, in _normalize_domain
return prefix + idna.encode(domain, uts46=True).lower().decode('ascii')
File "/usr/lib/python3.9/site-packages/idna/core.py", line 349, in encode
s = uts46_remap(s, std3_rules, transitional)
File "/usr/lib/python3.9/site-packages/idna/core.py", line 318, in uts46_remap
from .uts46data import uts46data
ImportError: cannot import name 'uts46data' from partially initialized module 'idna.uts46data' (most likely due to a circular import) (/usr/lib/python3.9/site-packages/idna/uts46data.py)
This happens beacause uts46_remap()
imports from .uts46data import uts46data
inside. When this happens in two threads in parallel, it leads to error above. Really hard to trigger, but it happens sometimes.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
The library is not thread safe #6256 - pyca/cryptography - GitHub
ObjectIdentifier::_name uses lazy import, which is not thread-safe. ... I think, could be solved by using Threading.lock...or, better, reorganize ...
Read more >C library functions that are not thread-safe - Arm Developer
The following table shows the C library functions that are not thread-safe. ... These functions are all thread-unsafe. Each contains a static buffer...
Read more >Thread Safety in Software Libraries on The Example of Anjay
A function or an object is said to be “thread-safe” when it can be called or used from multiple threads without explicit synchronization...
Read more >12 Developing Thread-safe Libraries
Routines within a library can be thread safe or not. A thread-safe routine is one that can be called concurrently from multiple threads...
Read more >Does PASOE have any settings for thread-safety?
The AVM has no way of knowing if a given ABL's external shared library (DLL) is thread-safe or not. It is the responsibility...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This bug has been open a while and I am keen to fix it. Before I roll up my sleeves and do some research on the best approach, I’d invite anyone who is more familiar with an appropriate idiomatic approach to contribute a patch to resolve it. My aim would be to preserve lazy loading the UTS46 data until needed, if possible.
I’ve not been able to reproduce this issue, so for now I am going to close this issue. If it can be reproduced happy to reopen.