JGroup 5 and Android

17 views
Skip to first unread message

Anton Gerdessen

unread,
May 8, 2025, 3:39:59 PMMay 8
to jgroups-dev
Hello,

I found some behavior I did not expect. I am using JGroup5 successfully on Android to send very large files to 25+ Android devices using multicast and ethernet to USB-C dongles. Files over 10G and it works. One thing I noticed is that the multicast port used, is not freed after I disconnect from the cluster.

If I just connect to a cluster, I dont send any messages at all. I have port 45678 configured.
When I execute ss -lnup on the Android devices, it shows me that port 45678 is still in use!
The only way to free the port is to restart the application.

I tried close and disconnect, but both leave the port open. This open port causes issues when the IP changes for the Android device, it then throws a:  java.net.BindException: bind failed: EADDRNOTAVAIL. I tried adding port_range, to see if a higher port number would be used but that doesnt work either.

I'm not a Jgroup expert, maybe my config is wrong:
<config xmlns="urn:org:jgroups"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<UDP  mcast_addr="239.8.8.8"
mcast_port="45678"
mcast_recv_buf_size="50MB"
thread_pool.min_threads="0"
thread_pool.max_threads="200"
thread_pool.keep_alive_time="30s" /> 
<PING /> 
<MERGE3 max_interval="20s" min_interval="10s" /> 
<FD_SOCK2 /> 
<FD_ALL3 />
<VERIFY_SUSPECT2 timeout="30s" /> 
<BARRIER /> 
<pbcast.NAKACK2 xmit_interval="0.5s" /> 
<UNICAST3 xmit_interval="0.5s"/> 
<pbcast.STABLE max_bytes="15M" /> 
<pbcast.GMS print_local_addr="true" join_timeout="1s" /> 
<MFC max_credits="50M" min_threshold="0.4" /> 
<UFC max_credits="50M" min_threshold="0.4" /> 
<FRAG2 frag_size="60K" /> 
<pbcast.STATE_TRANSFER /> 
</config>

Any advice is welcome. 

Anton


Anton Gerdessen

unread,
May 9, 2025, 1:43:50 AMMay 9
to jgroups-dev
Additionally, I tested this on Windows with the same config, as soon as I call close, the port is freed.

Bela Ban

unread,
May 9, 2025, 2:16:31 AMMay 9
to jgrou...@googlegroups.com
What's your UDP.bind_addr? I'm not familiar with running on android, and can therefore also not reproduce this.
When you close the app, port 45678 is still used? Can you use 'lsof' to see which process is using the port? If it is still the same app, can you trigger a stack trace?
--
You received this message because you are subscribed to the Google Groups "jgroups-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jgroups-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jgroups-dev/3d9eba88-573a-4769-816a-a051bbec6375n%40googlegroups.com.

-- 
Bela Ban | http://www.jgroups.org

Bela Ban

unread,
May 9, 2025, 2:19:45 AMMay 9
to jgrou...@googlegroups.com
Which leads to the conclusion that this is an Android problem? Is the port not closed on a real android device, or in an emulator?
--
You received this message because you are subscribed to the Google Groups "jgroups-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jgroups-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages