Bug 740317

Summary: [abrt] wicd-common-1.7.0-8.fc15: decorators.py:293:emit_signal:TypeError: DaemonClosing() takes exactly 1 argument (3 given)
Product: [Fedora] Fedora Reporter: alain.thiaville
Component: wicdAssignee: David Cantrell <dcantrell>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: dcantrell
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Unspecified   
Whiteboard: abrt_hash:ec065b4e3ea713a203239bbd2ec76b2ae1495739
Fixed In Version: wicd-1.7.0-12.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-11 16:54:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description alain.thiaville 2011-09-21 15:37:14 UTC
abrt version: 2.0.3
architecture:   i686
cmdline:        /usr/bin/python -O /usr/share/wicd/daemon/wicd-daemon.py
comment:        reproductible : I don't Know
component:      wicd
executable:     /usr/share/wicd/daemon/wicd-daemon.py
kernel:         2.6.40.3-0.fc15.i686
os_release:     Fedora release 15 (Lovelock)
package:        wicd-common-1.7.0-8.fc15
reason:         decorators.py:293:emit_signal:TypeError: DaemonClosing() takes exactly 1 argument (3 given)
time:           Fri Aug 19 13:32:46 2011
uid:            0
username:       root

backtrace:
:decorators.py:293:emit_signal:TypeError: DaemonClosing() takes exactly 1 argument (3 given)
:
:Traceback (most recent call last):
:  File "/usr/lib/python2.7/site-packages/dbus/service.py", line 748, in _message_cb
:    _method_reply_error(connection, message, exception)
:  File "/usr/lib/python2.7/site-packages/dbus/service.py", line 285, in _method_reply_error
:    contents = ''.join(traceback.format_exception(et, ev, etb))
:  File "/usr/lib/python2.7/traceback.py", line 141, in format_exception
:    list = list + format_tb(tb, limit)
:  File "/usr/lib/python2.7/traceback.py", line 76, in format_tb
:    return format_list(extract_tb(tb, limit))
:  File "/usr/lib/python2.7/traceback.py", line 101, in extract_tb
:    line = linecache.getline(filename, lineno, f.f_globals)
:  File "/usr/lib/python2.7/linecache.py", line 14, in getline
:    lines = getlines(filename, module_globals)
:  File "/usr/lib/python2.7/linecache.py", line 40, in getlines
:    return updatecache(filename, module_globals)
:  File "/usr/lib/python2.7/linecache.py", line 128, in updatecache
:    lines = fp.readlines()
:  File "/usr/lib/python2.7/site-packages/dbus/decorators.py", line 293, in emit_signal
:    func(self, *args, **keywords)
:TypeError: DaemonClosing() takes exactly 1 argument (3 given)
:
:Local variables in innermost frame:
:abs_path: None
:dbus_interface: 'org.wicd.daemon'
:path_keyword: None
:self: <__main__.WicdDaemon at /org/wicd/daemon at 0x8bdbd2c>
:args: (15, <frame object at 0x8c79a3c>)
:signature: ''
:rel_path: None
:func: <function DaemonClosing at 0x8bdd6f4>
:member_name: 'DaemonClosing'
:keywords: {}
:rel_path_keyword: None

Comment 1 David Cantrell 2012-02-14 13:50:54 UTC
Is this still happening on Fedora 16 with the latest wicd update?

Comment 2 alain.thiaville 2012-02-29 19:09:27 UTC
response : reproductible with the last version i.e: wicd-common1.7.0-10.fc16.noarch
 more info : It seems that the problem is located at the end of the program, 
    line 1815:
1809     # Enter the main loop
1810     mainloop = gobject.MainLoop()
1811     try:
1812         mainloop.run()
1813     except KeyboardInterrupt:
1814         pass
1815     daemon.DaemonClosing()

   the call by itself is correct; but is made out of the mainloop. I read
  the d-bus python documentation . The dynamic behaviour of signal isn't described; but this call (out of the mainloop) is for me useless: it's goal is to "D-BUS  signaling" to all wicd-daemon's subscribers the end of the daemon. For me when the loop is exited all sockets are at least in the closing state and no signal will be emitted on any D-Bus (system or session bus). The solution for me is

  1) "remove" all the code related to "DaemonClosing":
    Its place is not in a production repo.It is untested, unfinished and for me buggy. Furthermore,the code by itself LIES: in any case, even if unfortunately ,it succeeds the daemon doesn't exit at all. Hereafter, the method body of the method !!!! :
 847     @dbus.service.signal(dbus_interface='org.wicd.daemon', signature='')
 848     def DaemonClosing(self):
 849         """ Emits a signal indicating the daemon will be closing. """
 850         pass
  !!! or rename me stupidDaemonJoke (stupid because ... i am not a Class) 
   and document it !!!! 

  
  2) if for some reason,the strange behaviour "DaemonClosing" must be implemented  :
   2.1) remove the "offensing" call : line 1815
   2.2) triggers the action in the mainloop: that is partiallay done in the code
  line 116: (more signals are needed)
116         signal.signal(signal.SIGTERM, self.DaemonClosing)
   2.3) add a "sleep" (because the signal is "broadcasted" i.e: this message can't be acknowledge) in the member function class  "DaemonClosing"
   2.4) gently cleanup all permanent resources before exit

Comment 3 David Cantrell 2012-03-22 14:24:11 UTC
I have no problem with removing the code since it doesn't really do anything right now, but I would prefer that to happen upstream.  To work around the issue you're hitting, wouldn't something like this be sufficient:

diff -up wicd-1.7.1/wicd/wicd-daemon.py.orig wicd-1.7.1/wicd/wicd-daemon.py
--- wicd-1.7.1/wicd/wicd-daemon.py.orig	2012-02-02 11:38:26.000000000 -0500
+++ wicd-1.7.1/wicd/wicd-daemon.py	2012-03-22 10:21:38.735140300 -0400
@@ -812,7 +812,7 @@ class WicdDaemon(dbus.service.Object):
         pass
 
     @dbus.service.signal(dbus_interface='org.wicd.daemon', signature='')
-    def DaemonClosing(self):
+    def DaemonClosing(self, arg1=None, arg2=None):
         """ Emits a signal indicating the daemon will be closing. """
         pass

Comment 4 alain.thiaville 2012-03-26 09:47:48 UTC
For me the the best patch is to comment the faulty line 1815 .
I'm sure that the the faulty line is "daemon.DaemonClosing()": 
 to  reproduce the bug I replaced the dbus mainloop "i.e mainloop.run()" with a forever loop . Each time I killed the program with 'kill -15 pid' the bug appeared. For me, the redundant call "daemon.DaemonClosing()" has been added because the "normal" reponse to SIGTERM (signal.signal(signal.SIGTERM, self.DaemonClosing)) is never executed. 
  Mixing signals, threads, subprocess in python requires some care ,but in the daemon code nothing is done to synchronize threads or children processes. In python only the main thread receives the signal. In other words, the behaviour
of the the code on SIGTERM is undefined ...

Comment 5 Fedora Update System 2012-03-26 20:04:52 UTC
wicd-1.7.0-12.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/wicd-1.7.0-12.fc16

Comment 6 Fedora Update System 2012-03-31 02:59:06 UTC
Package wicd-1.7.0-12.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing wicd-1.7.0-12.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-4962/wicd-1.7.0-12.fc16
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2012-04-11 16:54:10 UTC
wicd-1.7.0-12.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.