Bug 45279 - McastServiceImpl leaks sockets.
Summary: McastServiceImpl leaks sockets.
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Cluster (show other bugs)
Version: 6.0.16
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-25 12:21 UTC by Robert Newson
Modified: 2009-07-01 12:31 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Newson 2008-06-25 12:21:15 UTC
McastServiceImpl does not close its socket in stop() as it claims. It merely calls leaveGroup(), which is sufficient to stop receiving messages, but does not close the socket. 

This causes a file descriptor leak each time the service is stopped.

add;

socket.close();

after leaveGroup();
Comment 1 Robert Newson 2008-06-25 13:13:34 UTC
btw, since it unreferences the socket without closing it, the next start() makes a new socket anyway.

I've hacked around this by using reflection to grab the reference to the multicast socket object before calling stop, then calling stop, then closing the socket myself.

Comment 2 Filip Hanik 2008-06-25 13:48:05 UTC
Fix suggested for back port into 6.0 branch
Comment 3 Filip Hanik 2008-06-30 13:03:21 UTC
Fixed in 6.0.x branch, will be included in 6.0.17 and forward

Comment 4 Rainer Jung 2009-07-01 12:31:52 UTC
Also applied to TC 5.5 as r790337.
Will be part of 5.5.28.