Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java on Tiger and UDP




From: Greg Guerin <email@hidden> Subject: Re: Java on Tiger and UDP To: email@hidden Message-ID: <l03130301bf0d6ff7074e@[216.190.249.205]> Content-Type: text/plain; charset="us-ascii"

Jamie Curmi wrote:


On Panther, you could send UDP packets > 16356 bytes from Java, and
receive them without issue.

On Tiger, any UDP packets > 16356 bytes are dropped.  You just never
receive them.


The MTU differs for the various network interfaces. In Terminal, type:
ifconfig


and inspect the mtu values for the lo0, en0, and other interfaces.

Here, under 10.4.2, I see:
  lo0 mtu 16384
  en0 mtu 1500

and several other interfaces. Since your example using "localhost", it's
almost certainly going over the lo0 interface (localhost loopback).


I suspect that your other platforms have different mtu sizes for lo0, or
whatever their equivalent is.


Under 10.3.5 here, I see the same mtu sizes, so maybe this isn't the
problem. Or maybe it's just that 10.4 is enforcing mtu strictly, or has
some other constraint being applied that 10.3 did not. It could also be
that Java on 10.4 is applying a constraint more strictly, regardless of
what the OS itself is doing. Hard to say without seeing the actual packets
on the network, or bringing a non-Java test program into play (either send
or receive).



In any case, the "m" in mtu stands for "maximum", and exceeding a maximum
seems dubious under the best of circumstances.


You might try using 'ifconfig' to change the mtu of lo0, or the other
interfaces. An interesting test would be to decrease the mtu and see if
your Java test case then failed at the reduced mtu level. That would be a
good indicator the limitation is mtu enforcement.

Thanks Greg, this has gone some way to finding a work-around. Changing the mtu for lo0 to something larger does in fact fix the problem.


However, the mtu is the same on other platforms (16k), but they do not have this problem we see in Tiger. Also, sending UDP packets over en0 (which has mtu 1500) allows packets up to 64k in size. It is only the lo0 interface that has this problem, and only under OS X Tiger.

Although the "m" stands for "maximum", the idea of the mtu is not to limit the size of the packets you send. The kernel, as I understand it, should take the larger packet, split it up to packets smaller than the mtu of the interface, send them, and re-assemble them at the other end. As mentioned, Tiger does this on en0, but not on lo0. Tiger seems to be the only platform acting this way with local host. Looks like a bug to me... Anyone from Apple have a comment?



However, the first thing I suggest is to print the stack-traces of
IOExceptions, rather than ignoring them completely.

If errors are happening in Send, you're not seeing what they are, nor
whether they even happen. It could be that Send is failing because of mtu
limits, so nothing is ever sent. You can't tell.


Send is always silent, even when it fails to send any packet. You may
never receive long packets for the simple reason they're never being sent.


Exceptions matter, especially in tests.

Exception were left out in order to give the mailing list the smallest sample code I could. Same with comments.


Jamie
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.