Re: [jgroups-dev] org.jgroups.protocols.UDP - failed sending message to null

Adrian Tarau <[email protected]> Sat, 18 Dec 2010 10:48:06 -0500
Newsgroups gmane.comp.java.javagroups.devel
Message-ID <[email protected]>
It is not an InterruptedIOException. Not sure how to reproduce it, It 
doesn't happen all the time. This week I was lucky to catch it under my 
IDE so I can provide more information.

This is where the exception is caught:

/try {
             send(msg, dest, multicast);
         }
         catch(InterruptedIOException iex) {
             ;
         }
         catch(InterruptedException interruptedEx) {
             Thread.currentThread().interrupt(); // let someone else 
handle the interrupt
         }
         catch(Throwable e) {
             if(log.isErrorEnabled()) {
                 log.error("failed sending message to " + dest + " (" + 
msg.size() + " bytes): " + e); <--- here
             }
         }
         return null;/


Using break points I was able to catch the culprit, its UDP._send

/private void _send(InetAddress dest, int port, boolean mcast, byte[] 
data, int offset, int length) throws Exception {
         DatagramPacket packet=new DatagramPacket(data, offset, length, 
dest, port);
         try {
             if(mcast) {
                 if(mcast_sock != null && !mcast_sock.isClosed())
                     mcast_sock.send(packet); <-- This is where it fails
             }
             else {
                 if(sock != null && !sock.isClosed())
                     sock.send(packet);
             }
         }
         catch(Exception ex) {
             throw new Exception("dest=" + dest + ":" + port + " (" + 
length + " bytes)", ex);
         }
     }/

So it seems like a Java/Linux kernel(based on some posts on the 
internet) problem but it is hard to debug since there is no stack trace. 
Maybe a configurable flag to trigger an exception with/without stack 
trace would be beneficial.

Thanks.

On 12/18/2010 09:00 AM, Bela Ban wrote:
> Let's start from scratch: what exactly is the error ? The code in 
> Discovery.start() which calls sendGetMembersRequest() catches the 
> InterruptedIOException, therefore you shouldn't even see this.
>
> The InvalidArgument IOException is new, how do you arrive at this ? 
> How do you reproduce it ?
>
> [1] https://issues.jboss.org/browse/JGRP-1161
>
>
> On 12/16/10 8:37 PM, Adrian Tarau wrote:
>> It's in the ticket, 2.10. I see thread interruption handling so it's not
>> that causing the exception, it's an IOException and it happens on the
>> multicast receiver & timer thread.
>>
>> The error message "Invalid argument" reminds me of failures when I did
>> some experiments with MulticastSocket. After several attempts to track
>> where the exception is thrown it is actually the MulticastSocket, it
>> fails in UDP:
>>
>> /private void _send(InetAddress dest, int port, boolean mcast, byte[]
>> data, int offset, int length) throws Exception {
>> DatagramPacket packet=new DatagramPacket(data, offset, length, dest, 
>> port);
>> try {
>> if(mcast) {
>> if(mcast_sock != null && !mcast_sock.isClosed())
>> * mcast_sock.send(packet);*
>> }
>> else {
>> if(sock != null && !sock.isClosed())
>> sock.send(packet);
>> }
>> }
>> catch(Exception ex) {
>> throw new Exception("dest=" + dest + ":" + port + " (" + length + "
>> bytes)", ex);
>> }
>> }
>> /
>> The DatagramPacket buffer has 103 bytes and it tries to send to
>> 228.110.10.10:46553(tried different addresses but it still fails).
>

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d

_______________________________________________
Javagroups-development mailing list