Bug 175248 - Debugger raises a ValueError Exception if the module is using signals
Debugger raises a ValueError Exception if the module is using signals
Status: CLOSED WONTFIX
Product: python
Classification: Unclassified
Component: Debugger
8.0.1
All Linux
: P3 (vote)
: TBD
Assigned To: Lou Dasaro
nbpythonqa
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-23 01:06 UTC by florentin
Modified: 2017-06-23 08:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description florentin 2009-10-23 01:06:21 UTC
Hello,
Debugging a project which uses signals (or a component which uses signals like twisted - twistedmatrix.com) raises a
ValueError Exception and the debugger stops.
An example of line which can make the debugger to stop is "signal.signal(signal.SIGTERM, self.sigTerm)"
This would raise "ValueError: signal only works in main thread" if it's used by the Python Debugger

I think this explains why (http://docs.python.org/library/signal.html#signal.signal):
"When threads are enabled, this function can only be called from the main thread; attempting to call it from other
threads will cause a ValueError exception to be raised."

Netbeans's Python debugger (called jpydaemon.py) starts my project (which uses signals) in a different thread.

>>>Exception in thread MainThread:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "/home/elmo/.netbeans/6.7/config/nbPython/debug/nbpythondebug/jpydaemon.py", line 590, in run
/home/elmo/.netbeans/6.7/config/nbPython/debug/nbpythondebug/jpydaemon.py
args =  ['/home/elmo/.netbeans/6.7/config/nbPython/debug/nbpythondebug/jpydaemon.py', 'localhost', '29100']
localDebuggee= None
JPyDbg connecting  localhost  on in=  29100 /out= 29101
JPyDbgI0001 : connected to  localhost
    exec self._cmd in self._myglobals,self._mylocals
  File "<string>", line 1, in <module>
  File "/media/small2/python/spiderpy/scrapy-ctl.py", line 7, in <module>
    execute()
  File "/usr/local/lib/python2.6/dist-packages/scrapy/command/cmdline.py", line 132, in execute
    scrapymanager.configure(control_reactor=True)
  File "/usr/local/lib/python2.6/dist-packages/scrapy/core/manager.py", line 66, in configure
    install_shutdown_handlers(self._signal_shutdown)
  File "/usr/local/lib/python2.6/dist-packages/scrapy/utils/ossignal.py", line 21, in install_shutdown_handlers
    reactor._handleSignals()
  File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1069, in _handleSignals
    signal.signal(signal.SIGTERM, self.sigTerm)
ValueError: signal only works in main thread
Comment 1 flotho 2014-10-11 16:05:30 UTC
Hy,

I installed the latest ND8.0 with the module.
I added a python project from source
I succeed in executing the project perfectly.
Unfortunately I still having issue while debugging :
LOG]PythonDebugger : overall Starting
[LOG]PythonDebugger.taskStarted : I am Starting a new Debugging Session ...
[LOG]This window is an interactive debugging context aware Python Shell 
[LOG]where you can enter python console commands while debugging 
>>>
[stdout:]2014-10-11 16:01:46,724 13349 DEBUG ? openerp.netsvc: logger level set: "openerp.netsvc.rpc.request:INFO"[stdout:]2014-10-11 16:01:46,726 13349 DEBUG ? openerp.netsvc: logger level set: "openerp.netsvc.rpc.response:INFO"[stdout:]2014-10-11 16:01:46,728 13349 DEBUG ? openerp.netsvc: logger level set: "openerp.addons.web.http:INFO"[stdout:]2014-10-11 16:01:46,730 13349 DEBUG ? openerp.netsvc: logger level set: "openerp.sql_db:INFO"[stdout:]2014-10-11 16:01:46,731 13349 DEBUG ? openerp.netsvc: logger level set: ":INFO"[stdout:]2014-10-11 16:01:46,733 13349 DEBUG ? openerp.netsvc: logger level set: "openerp:DEBUG"[stdout:]2014-10-11 16:01:46,736 13349 DEBUG ? openerp.netsvc: logger level set: "[':DEBUG']"[stdout:]2014-10-11 16:01:46,738 13349 INFO ? openerp: OpenERP version 7.0[stdout:]2014-10-11 16:01:46,740 13349 INFO ? openerp: addons paths: /home/florent/DEV/Projets_Attraptemps/Depot-OpenERP/trunk/magaddons,/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp/addons,/home/florent/DEV/Serveurs/openerp-7.0-series/web/addons,/home/florent/DEV/Serveurs/openerp-7.0-series/addons,/home/florent/DEV/Lib_Odoo/banking-addons,/home/florent/DEV/Lib_Odoo/bank-statement-reconcile-7.0,/home/florent/DEV/Lib_Odoo/pentahoreporting7.0/openerp_addon[stdout:]2014-10-11 16:01:46,743 13349 INFO ? openerp: database hostname: localhost[stdout:]2014-10-11 16:01:46,746 13349 INFO ? openerp: database port: 5432[stdout:]2014-10-11 16:01:46,748 13349 INFO ? openerp: database user: openerpsignal only works in main thread['Traceback (most recent call last):
', '  File "/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp-server", line 5, in <module>
    openerp.cli.main()
', '  File "/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp/cli/__init__.py", line 61, in main
    o.run(args)
', '  File "/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp/cli/server.py", line 272, in run
    main(args)
', '  File "/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp/cli/server.py", line 237, in main
    setup_signal_handlers()
', '  File "/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp/cli/server.py", line 194, in setup_signal_handlers
    map(lambda sig: signal.signal(sig, signal_handler), SIGNALS)
', '  File "/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp/cli/server.py", line 194, in <lambda>
    map(lambda sig: signal.signal(sig, signal_handler), SIGNALS)
', 'ValueError: signal only works in main thread
']
/home/florent/.netbeans/8.0/config/nbPython/debug/nbpythondebug/jpydaemon.py
args =  ['/home/florent/.netbeans/8.0/config/nbPython/debug/nbpythondebug/jpydaemon.py', 'localhost', '29100']
Debug session normal end
localDebuggee= None
JPyDbg connecting  localhost  on in=  29100 /out= 29101
JPyDbgI0001 : connected to  localhost
deamon ended

>>>

Is there any workaround for this?

regards
Comment 2 Lou Dasaro 2014-12-09 07:19:16 UTC
Thank you for your report. 
I did notice the debugger emitted "openerp: database user: openerpsignal only works in main thread". That might (?) be the problem.

If possible, please (first backup your project!) try to duplicate the anomaly with the latest DEV release (perhaps the EE bundle), and comment here with your findings.

Thanks in advance.
Comment 3 Jenselme 2017-06-22 22:21:14 UTC
Should be solved with the new debugger when we add it. The debugger is currently disabled. Closing this since there is no point into importing it elsewhere.
Comment 4 Jiri Kovalsky 2017-06-23 08:06:01 UTC
Thanks for your evaluation Julien. Reporter, if you think your issue is still valid and needs to be addressed, don't hesitate to reopen it with additional information. Closing for now.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo