Univention Bugzilla – Bug 40985
Firefox hangs when clicking on "finish" at the end of the setup wizard
Last modified: 2017-01-20 16:47:30 CET
With the changes of Bug 40046, Firefox is hanging when clicking on "finish" on the last page of the setup wizard. "finish" will trigger a JS function which calls window.close(). This problems only seems to be reproducible in a setup with DHCP, static IP addresses seem to work fine.
https://bugzilla.mozilla.org/show_bug.cgi?id=1105891#c24 → Maybe this problem is related to some problem with the profile? https://bugzilla.mozilla.org/show_bug.cgi?id=662444 → The shutdown process will trigger some shutdown operations which might end up in a deadlock. Not sure, but I had the impression that Bug 38866 might be related to this problem as well. I observed FF with a normal load and it did not hang with DHCP. Firefox also reports errors due to dbus missing (→ Bug 36168), not sure whether this could be related.
In about:config → toolkit.asyncshutdown.timeout.crash could be set to 1 (ms) (default value is 60000ms). This could be worth a try. Otherwise, I could not detect any other config parameters that might be of interest. Another workaround would be to install a temporary web service which allows to kill the Firefox session.
Problem has been reproduced in "demo mode" and when joining the system as UCS master.
Revision 68429: Closing Firefox by umcp command instead of window.close Successful build Package: univention-system-setup Version: 9.1.4-5.954.201604061432 Branch: ucs_4.1-0 Scope: appliance
Really nice fix :) ! Just some minor issues... (a) this.umcpCommand('setup/closefirefox', {keep_alive: true}, false); → As no data is transferred, this could be rather: this.umcpCommand('setup/closefirefox', {}, false); (b) def close_firefox(self, request): ... → Could have a simple_response decorator, then without the "request" parameter.
+ def close_firefox(self, request): + PATH_BROWSER_PID = '/var/cache/univention-system-setup/browser.pid' + try: + fpid = open(PATH_BROWSER_PID) + strpid = fpid.readline().strip() + pid = int(strpid) + p = psutil.Process(pid) + p.kill() + except IOError: + print 'WARN: cannot open browser PID file: %s' % PATH_BROWSER_PID + except ValueError: + print 'ERROR: browser PID is not a number: "%s"' % strpid + except psutil.NoSuchProcess: + print 'ERROR: cannot kill process with PID: %s' % pid 1. you don't need to define a constant for a variable which is only used once 2. use "with open(filename) as fd:" when opening files (to automatically close them) 3. don't use print, use MODULE.error() try: with open('/var/cache/univention-system-setup/browser.pid', 'rb') as fd: pid = int(fd.readline().strip()) process = psutil.Process(pid) p.kill() except IOError as exc: MODULE.error('cannot open PID file: %s' % (exc,)) …
Added suggestions from Comment 5 and 6. Rev. 68438: Code cleanup Rev. 68439: Corrected typo Successful build Package: univention-system-setup Version: 9.1.4-7.956.201604061840 User: emai Branch: ucs_4.1-0
What in case of an error? Maybe the window.close() should be readded to the error handler of the umcpCommand deferred - even if it takes 5 minutes then it's better than closing it never.
Rev. 68509: Added error handling. Package: univention-system-setup Version: 9.1.4-8.957.201604081401 Branch: ucs_4.1-0 Scope: appliance
Just a small hint: You don't have to use psutil to kill a process. You can simply use os.kill(pid).
os.kill(pid, 9) 9 is signal.SIGKILL. 15 is signal.SIGTERM. Maybe SIGTERM is better?
(In reply to Florian Best from comment #11) > os.kill(pid, 9) > > 9 is signal.SIGKILL. > 15 is signal.SIGTERM. > Maybe SIGTERM is better? Not sure, looking at the FF bug when the process is hanging.
Firefox does exit for me on SIGTERM in this particular case. However SIGKILL seems fine to me, as system-setup does not rely on Firefox exiting gracefully.
Changes: OK, works like a charm. YAML: OK → VERIFIED
<http://errata.software-univention.de/ucs/4.1/234.html>