Bug 997424

Summary: threads not dumped to anaconda-tb-* after exception
Product: [Fedora] Fedora Reporter: Steve Tyler <stephent98>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: anaconda-maint-list, dshea, g.kaviyarasu, jonathan, mkolman, sbueno, stephent98, vanmeeuwen+fedora
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-02 17:36:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
[19.30.13-1] anaconda-tb-bz981436-at768904.log
none
[20.6-1] anaconda-tb-all.log none

Description Steve Tyler 2013-08-15 13:33:22 UTC
Created attachment 786940 [details]
[19.30.13-1] anaconda-tb-bz981436-at768904.log

Description of problem:
The anaconda dumpState() function is supposed to be dumping the threads, but this recent anaconda-tb* file does not show any threads:
Bug 981436, Attachment 768904 [details]

$ grep Threads anaconda-tb-bz981436-at768904.log
$ 

$ less -N anaconda-19.30.13-1/pyanaconda/__init__.py
...
    168     def dumpState(self):
...
    178         # gather up info on the running threads
    179         threads = "\nThreads\n-------\n"
    180         for thread_id, frame in sys._current_frames().iteritems():
    181             threads += "\nThread %s\n" % (thread_id,)
    182             threads += "".join(format_stack(frame))
...

$ grep -Rn --exclude='*.pyc' dumpState anaconda-19.30.13-1
anaconda-19.30.13-1/anaconda.spec.in:1977:- Fix dumpState to work with the new python-meh (#856235) (vpodzime)
anaconda-19.30.13-1/anaconda:1022:    signal.signal(signal.SIGUSR2, lambda signum, frame: anaconda.dumpState())
anaconda-19.30.13-1/pyanaconda/__init__.py:168:    def dumpState(self):
anaconda-19.30.13-1/pyanaconda/__init__.py:173:        # Skip the frames for dumpState and the signal handler.

$ cat -n anaconda-19.30.13-1/anaconda.spec.in | gedit -
...
  1906	* Wed Sep 26 2012 Chris Lumens <clumens> - 18.10-1
...
  1976	- Add a way to test exception handling (vpodzime)
  1977	- Fix dumpState to work with the new python-meh (#856235) (vpodzime)
...

Version-Release number of selected component (if applicable):
anaconda-19.30.13-1

How reproducible:
Presumably, always.

Steps to Reproduce:
1. Crash anaconda.

Actual results:
Threads are not dumped to anaconda-tb-*.

Expected results:
Threads are dumped to anaconda-tb-*.

Additional info:
This is the bug used for the example:
Bug 981436 - error: rpmdb open failed

Comment 1 Steve Tyler 2013-08-15 22:42:19 UTC
Created attachment 787095 [details]
[20.6-1] anaconda-tb-all.log

With anaconda 20.6-1, there is a thread dump at the end of the log file. The log file was captured while paused at the Installation Summary dialog with:
# pkill -USR2 -o anaconda

Tested with:
$ qemu-kvm -m 4096 -hda f20-test-1.img -cdrom ~/xfr/fedora/nightly-composes/Fedora-20-Nightly-x86_64-Live-desktop-20130815.09-1.iso -vga std -boot menu=on

$ less -N anaconda-tb-all.log
...
   3838 Threads
   3839 -------
   3840 
   3841 Thread 140175569446720
   3842   File "/sbin/anaconda", line 1080, in <module>
   3843     anaconda._intf.run()
   3844   File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/__init__.py", line 369, in run
   3845     Gtk.main()
   3846   File "/usr/lib64/python2.7/site-packages/gi/overrides/GLib.py", line 634, in <lambda>
   3847     return (lambda data: callback(*data), user_data)
   3848   File "/sbin/anaconda", line 1016, in <lambda>
   3849     signal.signal(signal.SIGUSR2, lambda signum, frame: anaconda.dumpState())
   3850   File "/usr/lib64/python2.7/site-packages/pyanaconda/__init__.py", line 174, in dumpState
   3851     threads += "".join(format_stack(frame))
   3852

Comment 2 Steve Tyler 2013-08-15 22:46:59 UTC
Closing NEXTRELEASE, because this is fixed with anaconda 20.6-1.

Comment 3 Steve Tyler 2013-08-16 05:27:42 UTC
These anaconda 20.6-1 exception reports do not have Threads dumps:

Bug 997690, Attachment 787130 [details]:
Bug 997690 - SizeNotPositiveError: bytes= param must be >=0

Bug 997711, Attachment 787143 [details]:
Bug 997711 - NameError: global name 'logicals' is not defined

Reopening.

Comment 4 Steve Tyler 2013-08-17 09:25:12 UTC
The problem seems to be that dumpState(), which dumps threads, is only invoked when a SIGUSR2 is received.

$ grep -Rn dumpState anaconda-20.6-1/
anaconda-20.6-1/anaconda.spec.in:2030:- Fix dumpState to work with the new python-meh (#856235) (vpodzime)
anaconda-20.6-1/anaconda:1016:    signal.signal(signal.SIGUSR2, lambda signum, frame: anaconda.dumpState())
anaconda-20.6-1/pyanaconda/__init__.py:158:    def dumpState(self):
anaconda-20.6-1/pyanaconda/__init__.py:164:        # Skip the frames for dumpState and the signal handler.