Bug 229263 - Process pcscd is running amok (Class 0805: Texas Instruments PCI6411/6421/6611/6621/7411/7421/7611/7621 Secure Digital Controller)
Process pcscd is running amok (Class 0805: Texas Instruments PCI6411/6421/661...
Status: CLOSED INSUFFICIENT_DATA
Product: Fedora
Classification: Fedora
Component: pcsc-lite (Show other bugs)
rawhide
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bob Relyea
bzcl34nup
:
: 247433 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-19 15:16 EST by Miles Lane
Modified: 2008-05-06 21:12 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-06 21:12:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
strace output (29.67 KB, text/plain)
2007-02-20 03:36 EST, Miles Lane
no flags Details
reader.conf (727 bytes, text/plain)
2007-02-21 19:13 EST, Miles Lane
no flags Details
output of "strace -f -F pcscd --foreground --debug" (12.59 KB, text/plain)
2007-02-21 19:20 EST, Miles Lane
no flags Details

  None (edit)
Description Miles Lane 2007-02-19 15:16:25 EST
Description of problem:

On my updated rawhide installation, pcscd constantly consumes around
35% of the cpu cycles.  

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

pcsc-lite-1.3.3-1.fc7

How reproducible:

In my case, just boot the machine.
  
Additional info:

         From fedora-test-list@redhat.com:

On 2/19/07, Ray Strode <rstrode@redhat.com> wrote:
> Miles Lane wrote:
> > Hi,
> >
> > On my updated rawhide installation, pcscd constantly consumes around
> > 35% of the cpu cycles.  I have taken to shutting of the service.  Any
> > idea how I can troubleshoot this?  Is this a bug, or just an issue
> > with my configuration?
> pcscd is a smart card daemon.  If you don't use smart cards for
> authentication, you can just turn it off with /sbin/chkconfig pcscd off
>
> It sounds like a bug, can you file it?  Running strace -s512 -f -p
> $(/sbin/pidof pcscd) might give some indication what it's doing (or
> getting a backtrace from gdb)

Very strange.  When I attached strace, the cpu cycles used dropped
down to nothing.  Then, when I stopped pcscd and tried to restart it,
the process won't start up again.  I wonder whether strace somehow
caused pcscd to not stop cleanly?  I'll file a bug and post with the
bug ID.  Should I CC you inside the bug report?

strace -s512 -f -p $(/sbin/pidof pcscd)
Process 2081 attached with 2 threads - interrupt to quit
[pid  2063] select(6, [5], NULL, NULL, NULL <unfinished ...>
Process 2063 detached
Process 2081 detached
Process 2063 detached
[root@hogwarts ~]# /etc/init.d/pcscd stop
Stopping PC/SC smart card daemon (pcscd):                  [  OK  ]
[root@hogwarts ~]# /etc/init.d/pcscd start
Starting PC/SC smart card daemon (pcscd):                  [FAILED]

/var/log/messages contains:
Feb 19 10:19:41 hogwarts pcscd: pcscdaemon.c:93:GetDaemonPid() Can't
open /var/run/pcscd.pid: No such file or directory
Feb 19 10:19:41 hogwarts pcscd: pcscdaemon.c:415:main() file
/var/run/pcscd.pub already exists.
Feb 19 10:19:41 hogwarts pcscd: pcscdaemon.c:417:main() Maybe another
pcscd is running?
Feb 19 10:19:41 hogwarts pcscd: pcscdaemon.c:420:main() I can't read
process pid from /var/run/pcscd.pid
Feb 19 10:19:41 hogwarts pcscd: pcscdaemon.c:423:main() Remove
/var/run/pcscd.pub and /var/run/pcscd.comm
Feb 19 10:19:41 hogwarts pcscd: pcscdaemon.c:425:main() if pcscd is
not running to clear this message.
Comment 1 Ludovic Rousseau 2007-02-20 02:31:29 EST
- kill all processes called pcscd (if any)
- remove /var/run/pcscd.pub
- start pcscd as: pcscd --foreground --debug
- copy&paste the generated logs in this bug report

thanks
Comment 2 Miles Lane 2007-02-20 02:43:38 EST
#> pcscd --foreground --debug
pcscdaemon.c:319:main() pcscd set to foreground with debug send to stderr
debuglog.c:211:DebugLogSetLevel() debug level=debug
pcscdaemon.c:533:main() pcsc-lite 1.3.3 daemon ready.
hotplug_libusb.c:394:HPEstablishUSBNotifications() Driver ifd-cyberjack.bundle
does not support IFD_GENERATE_HOTPLUG
Comment 3 Ludovic Rousseau 2007-02-20 02:54:30 EST
Not enough debug info.
Do you still have a pcscd consuming 35% of CPU?
Use Ctrl-C to kill pcscd.

Now try: strace -f -F pcscd --foreground --debug
Comment 4 Miles Lane 2007-02-20 03:36:55 EST
Created attachment 148403 [details]
strace output
Comment 5 Miles Lane 2007-02-20 03:37:40 EST
Yes, the cpu cycles are still getting chewed.
Comment 6 Bob Relyea 2007-02-20 12:00:40 EST
Miles:

2 Questions:
1) is this new for 1.3.3?
2) does it go away under any of the following conditions:
    a. Temporarily rename /usr/lib/pkcs11/libcoolkeypk11.so
    b. Temporarily move /usr/lib/pcsc/drivers/ifd-egate.bundle our of the
drivers directory.
You should restart pcscd and gdm after trying each of these. If the 35% CPU goes
away we can start looking at these components instead.

Thanks.

bob
Comment 7 Miles Lane 2007-02-20 14:44:32 EST
I am not sure how long ago this problem started.  Can you point me to earlier
packages for pcscd that I can test?

It has nothing to do with coolkeys, because I didn't have it installed.  I just
tried installing it to see whether that would help, but it didn't.  I tried
renaming /usr/lib/pcsc/drivers/ifd-egate.bundle and
/usr/lib/pcsc/drivers/ifd-cyberjack.bundle, but that also did not help.
Comment 8 Ludovic Rousseau 2007-02-20 15:44:15 EST
It looks like pcscd is continuously scanning the USB bus.

I would need some debug from pcscd but you need to recompile pcscd after
patching the file src/hotplug_libusb.c like:
Index: src/hotplug_libusb.c
===================================================================
--- src/hotplug_libusb.c    (révision 2408)
+++ src/hotplug_libusb.c    (copie de travail)
@@ -39,7 +39,7 @@
 #include "sys_generic.h"
 #include "hotplug.h"

-#undef DEBUG_HOTPLUG
+#define DEBUG_HOTPLUG
 #define ADD_SERIAL_NUMBER

 #define BUS_DEVICE_STRSIZE 256


Maybe Bob can provide a RPM with the needed change.

Then start: pcscd --foreground --debug
Comment 9 Miles Lane 2007-02-20 16:07:36 EST
Setting up the entire Gnome build environment would be difficult for me, since I
am low on disk space.  So, it would be very helpful if you could provide the
debug package.  Thanks!
Comment 11 Miles Lane 2007-02-20 18:46:18 EST
hotplug_libusb.c:196:HPReadBundleValues() Increase driverTracker to 96 entries
hotplug_libusb.c:182:HPReadBundleValues() Found driver for: Pertosmart Card Reader
hotplug_libusb.c:182:HPReadBundleValues() Found driver for: Pertosmart Card Reader
hotplug_libusb.c:182:HPReadBundleValues() Found driver for: WB Electronics
Inifinty USB Ulimited
hotplug_libusb.c:182:HPReadBundleValues() Found driver for: REINER SCT CyberJack
hotplug_libusb.c:182:HPReadBundleValues() Found driver for: REINER SCT CyberJack
pp_a
hotplug_libusb.c:234:HPReadBundleValues() Found drivers for 93 readers
hotplug_libusb.c:394:HPEstablishUSBNotifications() Driver openct-ifd.bundle does
not support IFD_GENERATE_HOTPLUG

ifd-egate.i386                           0.05-16                installed       
openct.i386                              0.6.11-2.fc7           installed     
pcsc-lite-openct.i386                    0.6.11-2.fc7           installed    
ccid.i386                                1.2.1-1.fc7            installed       
ifd-egate.i386                           0.05-16                installed       
pcsc-tools.i386                          1.4.8-1.fc7            installed       
pcsc-lite.i386                           1.3.3-1.rawhide_bob    installed       
ctapi-cyberjack-pcsc.i386                2.0.13beta5-2.fc7      installed       
pcsc-lite-libs.i386                      1.3.3-1.fc7            installed       
pcsc-perl.i386                           1.4.4-3.fc7            installed       
Comment 12 Ludovic Rousseau 2007-02-21 02:40:58 EST
- send the output of: "cat /etc/reader.conf"

- rename /usr/lib/pcsc/drivers to /usr/lib/pcsc/drivers.old and start again: send the _complete_ pcscd 
logs and check the CPU utilisation.
Comment 13 Miles Lane 2007-02-21 19:13:40 EST
Created attachment 148551 [details]
reader.conf
Comment 14 Miles Lane 2007-02-21 19:20:34 EST
Created attachment 148553 [details]
output of "strace -f -F pcscd --foreground --debug"
Comment 15 Miles Lane 2007-02-21 19:26:22 EST
Moving the /usr/lib/pcsc/drivers to /usr/lib/pcsc/drivers.bak causes pcscd to no
longer chew cpu cycles.  This doesn't seem too surprising, given that:

hotplug_libusb.c:109:HPReadBundleValues() Cannot open PC/SC drivers directory:
/usr/lib/pcsc/drivers
hotplug_libusb.c:110:HPReadBundleValues() Disabling USB support for pcscd.
Comment 16 Ludovic Rousseau 2007-02-22 05:31:52 EST
Now create an empty directory /usr/lib/pcsc/drivers and move the drivers from
/usr/lib/pcsc/drivers.bak one after the other in the new directory. After each
move restart pcscd to check if you have the problem or not.

I suggest to start with ccid.i386 as I know it well.

The idea is to know if the problem is in pcscd itself of in a driver loaded by
pcscd.
Comment 17 Miles Lane 2007-02-22 13:02:28 EST
Having these three directories present causes no trouble:  ifd-ccid.bundle,
ifd-egate.bundle, serial

Having either of these two directories present causes the CPU usage to jump: 
ifd-cyberjack.bundle and openct-ifd.bundle
Comment 18 Ludovic Rousseau 2007-02-22 14:51:10 EST
Ok. So the bug(s) should be in these two drivers.

Bob, can you try to reproduce the problem?
Comment 19 Bob Relyea 2007-02-22 17:11:49 EST
Miles, where did ifd-cyberjack.bundle and openct-ifd.bundle come from? 

bob
Comment 20 Miles Lane 2007-02-23 00:12:27 EST
ctapi-cyberjack-pcsc-2.0.13beta5-2.fc7
pcsc-lite-openct-0.6.11-2.fc7
Comment 21 Bob Relyea 2007-06-11 18:29:41 EDT
I've gone to long with out responding to this bug.

OK, I have 2 theories here both revolve around the fact that
ifd-cyberjack.bundle and openct-ifd.bundle are using the old 'wakeup and poll
method'.

Theory 1 (most likely:). Jack found a bug in ifd-egate-0.05-16 where is you
weren't using the new polling method, you would wind up in a busy loop (bug
232983). He fixed that in ifd-egate-0.05-17.

If ifd-cyberjack.bundle or openct-ifd.bundle is loaded, pcsc-lite will switch
back to the old polling method rather than the wake up with udev method.

We can test theory 1 either by removing ifd-egate or using the latest version of
ifd-egate and seeing if the problem goes away.

Theory 2 (less likely). There is a missing sleep in pcsc-lite when we fall back
to the old poll method. If loading ifd-cyberjack.bundle by itself triggers the
CPU jump, then it's likely that theory 2 is the problem.


Comment 22 Giuseppe Paterno 2007-10-10 11:22:45 EDT
*** Bug 247433 has been marked as a duplicate of this bug. ***
Comment 23 Bug Zapper 2008-04-03 15:11:48 EDT
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.
Comment 24 Bug Zapper 2008-05-06 21:12:26 EDT
This bug has been in NEEDINFO for more than 30 days since feedback was
first requested. As a result we are closing it.

If you can reproduce this bug in the future against a maintained Fedora
version please feel free to reopen it against that version.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

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