[Bug 2955] New: Resource leak in IPC subsystem

bugzilla-daemon at icedtea.classpath.org bugzilla-daemon at icedtea.classpath.org
Wed May 11 17:07:11 UTC 2016


http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2955

            Bug ID: 2955
           Summary: Resource leak in IPC subsystem
           Product: Thermostat
           Version: hg
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Thermostat
          Assignee: unassigned at icedtea.classpath.org
          Reporter: sgehwolf at redhat.com
                CC: thermostat at icedtea.classpath.org

While working some more on the byteman plugin I've discovered that the test
program I run might break sending messages to thermostat due to running out of
file descriptors. Exception message saying: "Too many open files".

Here is how this can be reproduced:

1. Build thermostat
2. $ rm -rf ~/.thermostat
3. $ ./distribution/target/image/bin/thermostat-devsetup
4. $ export THERMOSTAT_BASE=$(pwd)
5. Change to some other directory outside the thermostat tree
6. $ hg clone \
    
http://icedtea.classpath.org/people/jerboaa/byteman-thermostat-infinite-loop
7. $ cd byteman-thermostat-infinite-loop
8. $ mvn package
9. $ java -jar target/byteman-thermostat-infinite-loop-*.jar
10. Go back to $THERMOSTAT_BASE dir
11. $ ./distribution/target/image/bin/thermostat web-storage-service

Then observe the list of open file descriptors with:

$ watch -n 3 'lsof | grep thermostat | grep socks | wc -l'

Actual results:
The number of open file descriptors grows very rapidly until running out of
them.

Expected results:
Open file descriptors remains approximately stable.

Additional info:
$ lsof | grep thermostat | grep socks | tail
java      15457 15810 sgehwolf 1332u     unix 0xffff880386af13c0         0t0   
2312520 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1333u     unix 0xffff880386af1780         0t0   
2312521 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1334u     unix 0xffff88013fb5f3c0         0t0   
2312522 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1335u     unix 0xffff8803f4c05dc0         0t0   
2312523 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1336u     unix 0xffff8803cd8c2d00         0t0   
2312524 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1337u     unix 0xffff880194747b40         0t0   
2482151 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1338u     unix 0xffff880002ab2d00         0t0   
2482152 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1339u     unix 0xffff88034ae753c0         0t0   
2482153 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1340u     unix 0xffff88013a8e7780         0t0   
2482154 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM
java      15457 15810 sgehwolf 1341u     unix 0xffff8803bfc283c0         0t0   
2482155 /run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394 type=STREAM

Corresponding jps output is:
$ jps
15457 Thermostat
15394 byteman-thermostat-infinite-loop-0.0.1-SNAPSHOT.jar
16055 Jps
13114 org.eclipse.equinox.launcher_1.3.100.v20160416-2200.jar
15516 CommandChannelServerMain

So the process holding on to those files is Thermostat itself (15457). It's
(done?) reading on socket file
/run/user/15263/thermostat-socks/sock-bfc2140f_9eb4_015394. The last bit of the
socket name is the pid of the peer process, in this case the instrumented
process with byteman sending messages to Thermostat using unix sockets (15394 -
byteman-thermostat-infinite-loop-0.0.1-SNAPSHOT.jar).

It looks to me that the API of AgentIPCService needs to get enhanced to be able
to independently open and close a connection to the unix socket file
(independently of the file being created and deleted). Then the backend in
Thermostat (BytemanMetricsReceiver) could close the channel once done. The
byteman helper would open() it on each send().

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20160511/5c6ab417/attachment.html>


More information about the distro-pkg-dev mailing list