[Pcsclite-muscle] Problem (sigsegv) on reconnect.

luc.mazardo at orange.com luc.mazardo
Fri Jun 19 02:57:58 PDT 2015


Hello,

On 12/06/2015 16:33, Ludovic Rousseau wrote:

> Are you using threads in your application?
Yes

> Does each thread use its own PC/SC context (SCardEstablishContext)?
No, we use javax.smartcardio based on SCardEstablishContext called by
PCSCTerminals.initContext().
initContext() is called at the time the shared object (libpcsc.so*) is
opened.
The implementation of initContext() keeps the result in a singleton.

<code from="openjdk-7-fcs-src-b147-27_jun_2011">
    static synchronized void initContext() throws PCSCException {
        if (contextId == 0) {
            contextId = SCardEstablishContext(SCARD_SCOPE_USER);
        }

</code>

> Why do you use this configuration?
(DAEMON_ARGS="--max-card-handle-per-reader 1")
With the attached file PcscdTest.java, we have stressed the web
application over ab (apache2-utils), and we
have determined that this configuration


On 12/06/2015 16:33, Ludovic Rousseau wrote:
> 2015-06-11 17:39 GMT+02:00  <luc.mazardo at orange.com>:
>> Hello,
> Hello,
>
>> We've got some troubles with "libpcsclite". Perhaps, you could help us.
>>
>> Context :
>> ----------
>> We use 3 card readers (SCM SCR 3310) with pcscd on Debian Linux with
>> java environment.
>>
>> We 've made a regular backport from latest release of 1.8.13 (remove
>> dependencies
>> to systemd named bpo60+1oab2) on squeeze (debian 6) Linux machines.
>>
>> Here is a description of our environment, we are in a Java environment
>> (1.6.0_31) :
>> * Frontal : Apache / Tomcat
>> * Backend : Web application with API javax.smartcardio initialized with :
>>     System.setProperty("sun.security.smartcardio.library",
>> /usr/lib/libpcsclite.so);
>>
>> At the frequency of 5 seconds, we monitor cards on reader (haproxy check).
>>
>> The problem :
>> Sometimes, a sigsegv occurs on libpcsclite on winscard_clnt.c:979
>>     (void)pthread_mutex_unlock(&currentContextMap->mMutex);
>>
>> This sigsegv implies sudden death of Tomcat (cf java_frames).
>>
>> This part of code ( winscard_clnt.c:971) seems a bit strange :
>>
>>               /* the hCard handle is now invalid
>>                  * -> another thread may have called SCardReleaseContext
>>                  *    so the mMutex has been unlocked (and is now invalid)
>>                  * -> another thread may have called SCardDisconnect
>>                  *    so the mMutex is STILL locked
>>                  * since we don't know just unlock the mutex */
>>
>> Why releasing mutex since "mMutex has been unlocked (and is now invalid)" ?
> Good point. I will check that again.
>
> Are you using threads in your application?
> Does each thread use its own PC/SC context (SCardEstablishContext)?
>
>> Here is the configuration of the machine.
>>
>> CCID driver version     (dpkg -l | grep -i ccid)
>> -------------------------
>> libccid                                            1.3.11-2
>>
>> pcsc-lite version
>> ---------------------
>> ii  libpcsclite-dev    1.8.13~bpo60+1oab2           Middleware to access a
>> smart card using PC/SC (development files)
>> ii  libpcsclite1         1.8.13~bpo60+1oab2           Middleware to access a
>> smart card using PC/SC (library)
>> ii  libpcsclite1-dbg  1.8.13~bpo60+1oab2           Middleware to access a
>> smart card using PC/SC (debugging symbols)
>> ii  pcscd                 1.8.13~bpo60+1oab2           Middleware to access
>> a smart card using PC/SC (daemon side)
>>
>> smart card reader name
>> --------------------------------
>> 0: SCM SCR 3310 [CCID Interface] 00 00
>> 1: SCM SCR 3310 [CCID Interface] 01 00
>> 2: SCM SCR 3310 [CCID Interface] 02 00
>>
>> the output of the command "/usr/sbin/pcscd --version"
>> ------------------------------------
>> pcsc-lite version 1.8.13.
>> Copyright (C) 1999-2002 by David Corcoran <corcoran at musclecard.com>.
>> Copyright (C) 2001-2011 by Ludovic Rousseau <ludovic.rousseau at free.fr>.
>> Copyright (C) 2003-2004 by Damien Sauveron <sauveron at labri.fr>.
>> Report bugs to <muscle at lists.musclecard.com>.
>> Enabled features: Linux x86_64-pc-linux-gnu serial usb libudev
>> usbdropdir=/usr/lib/pcsc/drivers ipcdir=/var/run/pcscd
>> configdir=/etc/reader.conf.d
>>
>> configuration of pcscd : /etc/default/pcscd
>> -----------------------------
>> DAEMON_ARGS="--max-card-handle-per-reader 1"
> Why do you use this configuration?
>
> Bye
>

-- 
Luc Mazardo
Orange Applications for Business


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PcscdTest.java
Type: text/x-java
Size: 1459 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20150619/ff6cb6e3/attachment.java>



More information about the pcsclite-muscle mailing list