Bug 818704 - Firefox hangs when window is closed after loading a ssl web page.
Firefox hangs when window is closed after loading a ssl web page.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pcsc-lite (Show other bugs)
6.3
Unspecified Unspecified
urgent Severity high
: rc
: ---
Assigned To: Bob Relyea
Asha Akkiangady
: ZStream
Depends On:
Blocks: 835616 960054 959927
  Show dependency treegraph
 
Reported: 2012-05-03 14:47 EDT by Asha Akkiangady
Modified: 2013-11-14 05:36 EST (History)
12 users (show)

See Also:
Fixed In Version: pcsc-lite-1.5.2-12.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-14 05:36:04 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
strace demonstrating defect (3.98 MB, application/octet-stream)
2013-03-08 13:40 EST, Robert Jackson
no flags Details

  None (edit)
Description Asha Akkiangady 2012-05-03 14:47:59 EDT
Description of problem:
Firefox hangs when window is closed after loading a ssl web page using certificates on a smart card.

Version-Release number of selected component (if applicable):
coolkey-1.1.0-20.el6.i686
pcsc-lite-1.5.2-7.el6.i686
firefox-10.0.4-1.el6_2.i686
xulrunner-10.0.4-1.el6_2.i686

How reproducible:


Steps to Reproduce:
1. A smart card is enrolled with signing and encryption certificates.
2. Start Firefox browser, trust CA certificate and load coolkey library security device.
3. Visit ssl secure website, authenticate using signing certificate on the smart card.
4. Web page displayed successfully.
5. Close FF window
  
Actual results:
Firefox process hangs.

Expected results:
Firefox process should close successfully.

Additional info:
FF process closes successfully if there is a delay of ~20-25 seconds after the page load and before closing the FF window.

Tried to collect stack trace attaching gdb to FF, did not get enough info needed, here is the trace:

# firefox -g
MOZILLA_FIVE_HOME=/usr/lib/firefox
  LD_LIBRARY_PATH=/usr/lib/firefox:/usr/lib/firefox/plugins:/usr/lib/firefox
DISPLAY=:0.0
FONTCONFIG_PATH=/etc/fonts:/usr/lib/firefox/res/Xft
DYLD_LIBRARY_PATH=/usr/lib/firefox:/usr/lib/firefox
     LIBRARY_PATH=
       SHLIB_PATH=/usr/lib/firefox:/usr/lib/firefox
          LIBPATH=/usr/lib/firefox:/usr/lib/firefox
       ADDON_PATH=
      MOZ_PROGRAM=/usr/lib/firefox/firefox
      MOZ_TOOLKIT=
        moz_debug=1
     moz_debugger=
moz_debugger_args=
/usr/lib/firefox/run-mozilla.sh: line 116: type: ddd: not found
/usr/bin/gdb  --args /usr/lib/firefox/firefox
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-55.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/lib/firefox/firefox...Reading symbols from /usr/lib/debug/usr/lib/xulrunner-2/xulrunner-stub.debug...done.
done.
(gdb) run -safe-mode
Starting program: /usr/lib/firefox/firefox -safe-mode
[Thread debugging using libthread_db enabled]
Detaching after fork from child process 7746.
failed to create drawable
[New Thread 0xb7affb70 (LWP 7747)]
[New Thread 0xb690ab70 (LWP 7748)]
[New Thread 0xb5f09b70 (LWP 7749)]
[New Thread 0xb53ffb70 (LWP 7750)]
[New Thread 0xb47ffb70 (LWP 7751)]
[New Thread 0xb3dfeb70 (LWP 7752)]
Detaching after fork from child process 7753.
[New Thread 0xb29ffb70 (LWP 7761)]
[New Thread 0xb1ffeb70 (LWP 7762)]
[New Thread 0xaffffb70 (LWP 7763)]
[New Thread 0xaf5feb70 (LWP 7764)]
[Thread 0xb29ffb70 (LWP 7761) exited]
[Thread 0xaffffb70 (LWP 7763) exited]
[New Thread 0xb29ffb70 (LWP 7765)]
[New Thread 0xaffffb70 (LWP 7766)]
[New Thread 0xadbffb70 (LWP 7767)]
[New Thread 0xad1feb70 (LWP 7768)]
[New Thread 0xac7fdb70 (LWP 7769)]
[New Thread 0xabdfcb70 (LWP 7770)]
[New Thread 0xab3fbb70 (LWP 7771)]
[Thread 0xab3fbb70 (LWP 7771) exited]
[New Thread 0xab3fbb70 (LWP 7772)]
[New Thread 0xaa7ffb70 (LWP 7774)]
[New Thread 0xa9dfeb70 (LWP 7775)]
[New Thread 0xa93fdb70 (LWP 7776)]
[New Thread 0xa89fcb70 (LWP 7777)]
[New Thread 0xa7bffb70 (LWP 7778)]
[Thread 0xa9dfeb70 (LWP 7775) exited]
[Thread 0xa93fdb70 (LWP 7776) exited]
[Thread 0xad1feb70 (LWP 7768) exited]
[Thread 0xab3fbb70 (LWP 7772) exited]
[Thread 0xb53ffb70 (LWP 7750) exited]
[Thread 0xa89fcb70 (LWP 7777) exited]

^C
Program received signal SIGINT, Interrupt.
0x00110424 in __kernel_vsyscall ()
(gdb) where
#0  0x00110424 in __kernel_vsyscall ()
#1  0x00866ceb in open () at ../sysdeps/unix/syscall-template.S:82
#2  0x02b46b31 in open (
    pcFile=0xbfff9b3c "/var/run/pcscd.events/event.7743.16989959", flags=1, 
    mode=0) at /usr/include/bits/fcntl2.h:60
#3  SYS_OpenFile (
    pcFile=0xbfff9b3c "/var/run/pcscd.events/event.7743.16989959", flags=1, 
    mode=0) at sys_unix.c:129
#4  0x02b4704c in StatSynchronizeContext (hContext=16989959) at utils.c:172
#5  0x02b42ce7 in SCardCancel (hContext=16989959) at winscard_clnt.c:3484
#6  0x02b38db9 in CKYCardContext_Cancel (ctx=0xadcddde0) at cky_card.c:867
#7  0x02b03c65 in SlotList::shutdown (this=0xadcd8c20) at slot.cpp:109
#8  0x02afcd2a in C_Finalize (pReserved=0x0) at coolkey.cpp:283
#9  0x079073d6 in SECMOD_CancelWait (mod=0xadcf0810) at pk11util.c:1240
#10 0x013ffebd in SmartCardMonitoringThread::Stop (this=0xadcddfb0)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsSmartCardMonitor.cpp:180
#11 0x013fff65 in SmartCardMonitoringThread::~SmartCardMonitoringThread (
    this=0xadcddfb0, __in_chrg=<value optimized out>)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsSmartCardMonitor.cpp:152
#12 0x01400082 in SmartCardThreadEntry::~SmartCardThreadEntry (
    this=0xadcddfc0, __in_chrg=<value optimized out>)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsSmartCardMonitor.cpp:82
#13 0x014000f6 in SmartCardThreadList::~SmartCardThreadList (this=0xae44b578, 
    __in_chrg=<value optimized out>)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsSmartCardMonitor.cpp:101
#14 0x013d3544 in nsNSSComponent::ShutdownSmartCardThreads (this=0xae42dd50)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsNSSComponent.cpp:749
#15 0x013d46c1 in nsNSSComponent::ShutdownNSS (this=0xae42dd50)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsNSSComponent.cpp:1899
#16 0x013d4772 in nsNSSComponent::DoProfileBeforeChange (this=0xae42dd50, 
    aSubject=0xa7d561f0)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsNSSComponent.cpp:2595
#17 0x013d48b9 in nsNSSComponent::Observe (this=0xae42dd50, 
    aSubject=0xa7d561f0, aTopic=0x1a981af "profile-before-change", 
    someData=0x1a9845c)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/security/manager/ssl/src/nsNSSComponent.cpp:2222
#18 0x01637de8 in nsObserverList::NotifyObservers (this=0xadcda3fc, 
    aSubject=0xa7d561f0, aTopic=0x1a981af "profile-before-change", 
    someData=0x1a9845c)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/xpcom/ds/nsObserverList.cpp:130
#19 0x01637e86 in nsObserverService::NotifyObservers (this=0xb6f3d850, 
---Type <return> to continue, or q <return> to quit---
    aSubject=0xa7d561f0, aTopic=0x1a981af "profile-before-change", 
    someData=0x1a9845c)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/xpcom/ds/nsObserverService.cpp:182
#20 0x00ae09ca in nsXREDirProvider::DoShutdown (this=0xbfffaff0)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/toolkit/xre/nsXREDirProvider.cpp:814
#21 0x00adb94d in ScopedXPCOMStartup::~ScopedXPCOMStartup (this=0xbfffb074, 
    __in_chrg=<value optimized out>)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/toolkit/xre/nsAppRunner.cpp:1109
#22 0x00adf8b9 in XRE_main (argc=2, argv=0xbffff534, aAppData=0xb7d23700)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/toolkit/xre/nsAppRunner.cpp:3580
#23 0x08049d8e in main (argc=2, argv=0xbffff534)
    at /usr/src/debug/xulrunner-10.0.4/mozilla-esr10/xulrunner/stub/nsXULStub.cpp:516
(gdb)
Comment 3 RHEL Product and Program Management 2012-05-07 00:04:48 EDT
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.
Comment 5 RHEL Product and Program Management 2012-07-10 04:06:54 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 6 RHEL Product and Program Management 2012-07-10 19:10:03 EDT
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.
Comment 7 RHEL Product and Program Management 2012-12-14 01:59:16 EST
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 8 Robert Jackson 2013-03-08 13:40:47 EST
Created attachment 707170 [details]
strace demonstrating defect
Comment 9 Robert Jackson 2013-03-08 13:41:31 EST
Updating as this bug is still present in 6.4:

To reproduce on a RHEL 6.4 workstation:

1.) Insert smart card (CAC in my case)
2.) Launch Firefox
3.) Browse to bugzilla.redhat.com  (don't log in or anything, just load the page)
4.) Close the browser

Result:
Firefox does not ever release the process.  I must kill the pid manually.

If smart card is not inserted while launching Firefox, this issue does not present.

Attached is an strace of firefox when this issue happens.  This is literally just loading bugzilla.redhat.com and then closing the browser, waiting ~5 seconds, then killing the process manually.  Notice that it hangs on:

mknod("/var/run/pcscd.events/event.4918.17028664", S_IFIFO|0644) = 0
open("/var/run/pcscd.events/event.4918.17028664", O_WRONLY) = ? ERESTARTSYS (To be restarted)
Comment 22 Bob Relyea 2013-04-24 13:32:48 EDT
changing component..
Comment 23 Ludovic Rousseau 2013-04-25 07:07:07 EDT
pcsc-lite-1.5.2-7.el6.i686 is quiet old now.
/var/run/pcscd.events/ is no more used since pcsc-lite 1.6.0

Can you reproduce the problem with a recent (>= 1.8.0) version of pcsc-lite?
Comment 25 Bob Relyea 2013-04-25 17:36:57 EDT
Ludovic, unfortunately we can't rebase from a stable platform. I did look at the newer versions and saw that the weren't using the events fifos anymore, so RHEL 7 shouldn't have his issue.

I should have a test that reproduces the problem as well as a patch. With the patch, there is still a race (there's a condition where the Cancel will happen to quickly and the thread doesn't get cancelled, but that just leads to the thread talking longer to die since we don't use 'wait forever'. This 'new' race is a narrower race than the one we are seeing, so the code isn't any worse off).

Note You need to log in before you can comment on or make changes to this bug.