ValueError: signal only works in main thread
See original GitHub issueHi, I used in Django runserver (dev) and uwsgi (production), same exception raised. It’s due to signal cannot be used in non-main thread.
Currently I have to monkey-patch HAS_SIGNAL = True
to HAS_SIGNAL = False
in f5/bigip/__init__.py
. Hope there will be an option to disable signal use. Thanks.
File "/usr/local/lib/python2.7/site-packages/f5/bigip/__init__.py", line 114, in post_configuration_setup
self._get_tmos_version()
File "/usr/local/lib/python2.7/site-packages/f5/bigip/__init__.py", line 120, in _get_tmos_version
signal.signal(SIGALRM, timeout_handler)
ValueError: signal only works in main thread
I put my code in Django views to get results from my GTM. It only works when I pass --noload --nothreading
to Django runserver.
Django:
django-admin runserver
uwsgi:
uwsgi --ini uwsgi-docker.ini
#######################
# content of uwsgi-docker.ini
#######################
[uwsgi]
projectname = xxx
base = /home/user/xxx
# Django-related settings
# the base directory (full path)
chdir = %(base)
# Django's wsgi file
module = xxx.wsgi:application
master = true
processes = 8
threads = 2
enable-threads = true
socket = 0.0.0.0:8000
vacuum = true
env = DJANGO_SETTINGS_MODULE=%(projectname).settings_env.prod
pythonpath = %(base)
pythonpath = %(base)/common_libs
pythonpath = %(base)/xxx
logto = %(base)/logs/uwsgi.log
buffer-size = 32768
# set max log file to about 100MB
log-maxsize = 100000000
log-backupname = %(base)/logs/uwsgi.log.last
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
ValueError: signal only works in main thread - Stack Overflow
Python signal handlers are always executed in the main Python thread, even if the signal was received in another thread. This means that...
Read more >signal only works in main thread of the main interpreter #1
I am getting this error "signal only works in main thread of the main interpreter". Can you please explain it to me, how...
Read more >ValueError('signal only works in main thread') - W&B Help
I'm running a hyper parameter sweep using PL and Weights and Biases's framework. Running on a GPU on Google Colab which causes all...
Read more >Issue 38904: "signal only works in main thread" in main thread
The problem for both modules is that the Python runtime may have actually been initialized in a different thread, which is the actual...
Read more >Django : ValueError: signal only works in main thread - YouTube
Django : ValueError : signal only works in main thread - Django - mod_wsgi [ Beautify Your Computer ...
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
@jobec this friday
@jobec this is now available