[jboss-jira] [JBoss JIRA] (JGRP-1420) DefaultSocketFactory: failed socket creations lead to sockets lingering in hashmap
Bela Ban (JIRA)
jira-events at lists.jboss.org
Tue Jan 24 11:22:19 EST 2012
[ https://issues.jboss.org/browse/JGRP-1420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661471#comment-12661471 ]
Bela Ban commented on JGRP-1420:
--------------------------------
Does it actually make sense to keep all sockets in the 'sockets' hashmap ? AFAICT, the only consumer of this functionality is probe.sh, but this is half-baked. For once, not all protocols really use the socket factory to create their sockets (e.g. FD_SOCK, STATE etc). Plus, we only add actively created sockets: sockets received as result of an accept() are *not* added to the hashmap !
TBD: remove the 'sockets' hashmap, leave everything else.
Possibly add an accept() callback and have all protocols create their sockets through the socket factory
> DefaultSocketFactory: failed socket creations lead to sockets lingering in hashmap
> ----------------------------------------------------------------------------------
>
> Key: JGRP-1420
> URL: https://issues.jboss.org/browse/JGRP-1420
> Project: JGroups
> Issue Type: Bug
> Reporter: Bela Ban
> Assignee: Bela Ban
> Fix For: 3.0.4, 3.1
>
>
> In TCPConnectionMap.TCPConnection(), the following code is executed:
> sock=socketFactory.createSocket(); // (1)
> sock.bind(); // (2)
> sock.connect(); // (3)
> In the first step, an unconnected socket is created and added to the 'sockets' hashmap in DefaultSocketFactory. This is used to dump the open sockets in a JGroups program (e.g. via probe.sh socks).
> However, if step (3) fails, e.g. because the destination is not reachable, the socket should be removed from the 'sockets' hashmap, but isn't !
> SOLUTIUON:
> #1 Check all occurrences of this or similar code and make sure exceptions don't lead to lingering sockets
> #2 Make the 'sockets' hashmap a weak hashmap, so refs can be GC'ed when memory is low
> #3 Store string reps of the sockets rather than the sockets themselves
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list