3

I've been trying to figure out why a Java program that uses UDP communication on Windows works 100% fine but seems to regularly drop packets on a macOS build of the JVM (8.x).

I saw another thread on StackExchange that was never really answered, but it appears that one of the people noticed a similar issue on OSX there as well.

I don't have the standard firewall enabled in preferences nor do I believe I have any special network settings which would interrupt UDP datagrams. As well, if I run the same program on a Windows 7 VM via VirtualBox on the same hardware, the program works just fine.

Any ideas of what to look for or if this is a known issue?

UPDATE 2018-11-24: More details. I'm running Java 1.8.0_92-b14 from Oracle on a MacPro3,1 and macOS 10.13.6. The program I'm running is ADTPro 2.0.2 as an ethernet server trying to communicate with an old Apple //e that has an Uthernet II running the other side of ADTPro. It is software to transfer disk images to/from the machines.

The problem is that transfers often timeout and abort and it appears that packets are getting lost and the code isn't sophisticated enough to error correct and resend/retry. Looking at the source code, it appears everything is in UDP which definitely raises suspicions. According to the maintainer on GitHub, the fact that it is using UDP is historical and nobody has done the work to convert it to TCP. Given that the software works just fine talking to a Windows machine with the same software and Java versions, I'm guessing it is something with macOS or the OSX Java build and asking if anyone knows how to determine for sure or otherwise. Does that help?

3
  • Can you describe the problem further? Is the problem only packet loss? How much packet loss? Which type of interface? (Ethernet?) Can you verify the packet loss with a packet trace? (Wireshark, tcpdump, etc) Which JVM are you running exactly? (Vendor and version)
    – jksoegaard
    Nov 23, 2018 at 17:19
  • how do you measure ?
    – Ruskes
    Nov 23, 2018 at 17:34
  • Provided more information.
    – bjb
    Nov 24, 2018 at 16:25

2 Answers 2

1

No - UDP isn't fundamentally broken on macOS (or any of the other AppleOS)

The definition of UDP is unicast data packets and due to the send and forget nature of the casting, delivery of these is sometimes jokingly called unreliable data packets.

As a troubleshooting step, my first triage step would be to establish that the switch and router are actually delivering the packets to the macOS interface. Wireshark or a management tool on your network would be excellent tools to record these packets to see if they are being delivered.

I wouldn't worry about people saying TCP is more or less reliable than UDP since UDP has many technical advantages for streaming performance and you are on the correct path focusing on a specific java application that consumes data on a specific Mac in your network. Lots of your details are good, but it's kind of like detailing the pressure in the tires and the color of the paint when you actually need to know if the driver took a right down your street.

Are you able to run Wireshark and verify the packets or get access to the network logs to verify the sender and also you might need to do a little research on UDP and ask a follow on question if this actually is more about networking.

1
  • I am able to get many packets across since it works for a random amount of time, but then it just drops out at some point and I have to wait for the software to realize there is a gap in communication and reset itself. Sure, it sounds like the software is to blame since it doesn't have good error handling (thus part of why I'm thinking it just needs to be rewritten with TCP to avoid this kind of issue), but the confusing part is that a Windows JVM on the same box does not demonstrate the same problem.
    – bjb
    Nov 24, 2018 at 21:05
0

Had a basic problem even with binding a datagram socket using Java 8. Game changing was to reduce send/receive buffer size to 8K by socket options.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .