[jboss-jira] [JBoss JIRA] Commented: (JGRP-739) check all bind_address against NetworkInterface.getByInetAddress() to see if it exists on the machine

Sei Syvalta (JIRA) jira-events at lists.jboss.org
Fri Dec 5 03:23:37 EST 2008


    [ https://jira.jboss.org/jira/browse/JGRP-739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12441326#action_12441326 ] 

Sei Syvalta commented on JGRP-739:
----------------------------------

This change is causing some problems in a Linux setup (which should be quite a standard one).

For some reason in that environment NetworkInterface.getByInetAddress(bind_addr); returns null. If I remove that check everything will work fine. I haven't defined bind_addr property, so bind_addr is InetAddress.getLocalHost() in that case. My guess is that tweaking hosts file might help, but as this OS is installed from a distribution without any additional configuration it is probable that there a quite a lot of similar setups.

I will include a patch which skips the check if localhost is used. In the second case I just changed a warning to be logged instead of throwing exceptions.

> check all bind_address against NetworkInterface.getByInetAddress() to see if it exists on the machine
> -----------------------------------------------------------------------------------------------------
>
>                 Key: JGRP-739
>                 URL: https://jira.jboss.org/jira/browse/JGRP-739
>             Project: JGroups
>          Issue Type: Feature Request
>            Reporter: Michael Newcomb
>            Assignee: Vladimir Blagojevic
>            Priority: Minor
>             Fix For: 2.7
>
>
> Could you add a check in Util.getBindAddress() that checks the bind_addr against NetworkInterface.getByInetAddress() and throws some sort of exception if no NetworkInterface is returned?
> I set my bind_addr via a database parameter and if the user mistakenly assigns the wrong bind address, it doesn't show up until UDP.createEphemeralDatagramSocket() when the localPort goes over 65535 because each attempt to create a DatagramSocket with the inet address that is not a local address throws a SocketException (actually a BindException) which is caught but ignored. When localPort finally goes over 65535 it throws an IllegalArgumentException.
> So, a check in Util.getBindAddress() to see if the bind_addr is even available on the machine would lead to a failure in the configuration stage (setProperties).
> As a side question, doesn't creating a DatagramSocket with port=0 guarantee an ephemeral port? Is it necessary to 'scan' for one? Perhaps a failure from the initial attempt with port=0 would wait a few ms and then try again with port=0?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list