Memory leak

Bug #1511674 reported by Zbych
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pcsc-lite (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I noticed that pcscd consumes a lot of memory (5GB after 48h since start) in one of my computers (ubuntu 14.04 64-bit pcsc-lite version 1.8.10.)
In debug mode pcscd shows a lot of USB "device removed" notifications:

00000102 hotplug_libudev.c:594:HPEstablishUSBNotifications() Device removed
00001297 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
[cut - long list of usb devices]
00000246 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x03EB, PID: 0x2044, path: /dev/bus/usb/001/067
00022327 winscard_svc.c:319:ContextThread() Received command: CMD_GET_READERS_STATE from client 5
00500329 winscard_svc.c:319:ContextThread() Received command: CMD_GET_READERS_STATE from client 5
00500341 winscard_svc.c:319:ContextThread() Received command: CMD_GET_READERS_STATE from client 5

Flood of "device removed" messages was caused by some broken USB device (not card reader - CDC-ACM device), but it doesn't explain why pcscd allocated 5GB of memory. Is it some memory leak in pcscd?

lsb_release -rd:
Description: Ubuntu 14.04.3 LTS
Release: 14.04

pcscd:
  Installed: 1.8.10-1ubuntu1
  Candidate: 1.8.10-1ubuntu1
  Version table:
 *** 1.8.10-1ubuntu1 0
        500 http://pl.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

Tags: trusty
Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

Hello,

First I need more information.
Please read https://pcsclite.alioth.debian.org/pcsclite.html#support and add the needed details in this bug report.

Revision history for this message
Zbych (bzb) wrote :

Hi Ludovic,

Below is the list of information you requested:

1. smart card reader driver name and version: no card reader was connected during the test, only test application was getting a list of card readers every 500ms

2. pcsc-lite version:
pcsc-lite version 1.8.10.
Copyright (C) 1999-2002 by David Corcoran <email address hidden>.
Copyright (C) 2001-2011 by Ludovic Rousseau <email address hidden>.
Copyright (C) 2003-2004 by Damien Sauveron <email address hidden>.
Report bugs to <email address hidden>.
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

3. Operating system or GNU/Linux distribution name and version:
Description: Ubuntu 14.04.3 LTS
Release: 14.04

4. Log is attached.

Please let me know if you need additional information.

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

Thanks for the log.
Your problem now is not with the flood of "Device removed" logs but with the RAM consumption. exact?

Do you also see the RAM consumption growing if your PC/SC application is NOT running?

Revision history for this message
Zbych (bzb) wrote :

Yes, the problem is that pcscd's memory consumption is growing over time. It doesn't matter if I stop my application or not.
I made the test again and after a minute, memory consumption increased from 22000kB to 28236kB

$ ps aux | grep pcscd && sleep 60 && ps aux | grep pcscd
root 7781 0.3 0.2 171316 22000 pts/1 Sl 16:20 0:00 /usr/sbin/pcscd
gden 7892 0.0 0.0 11740 928 pts/1 S+ 16:24 0:00 grep --color=auto pcscd

root 7781 0.3 0.3 171316 28236 pts/1 Sl 16:20 0:01 /usr/sbin/pcscd
gden 7905 0.0 0.0 11740 928 pts/1 S+ 16:25 0:00 grep --color=auto pcscd

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

A memory leak has been fixed in pcsc-lite 1.8.12
Can you install a newer version of pcscd (http://packages.ubuntu.com/wily/pcscd) and try again?

Revision history for this message
Zbych (bzb) wrote :

Thank you very much. It works!
Is there any chance to backport this fix to LTS version of Ubuntu?

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

I have no idea on how packports works on Ubuntu.
It looks like you can request it yourself https://wiki.ubuntu.com/UbuntuBackports

Changed in pcsc-lite (Ubuntu):
status: New → Fix Committed
Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Please SRU to Trusty.

Changed in pcsc-lite (Ubuntu):
status: Fix Committed → Fix Released
tags: added: trusty
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.