[MLton] svn MLton bind() error

Matthew Fluet fluet at tti-c.org
Thu Dec 21 09:20:54 PST 2006


 > It seems that svn MLton (rev 4993) fails when binding an internet
 > socket (UDP or TCP) to a port (unix sockets work as expected).
 >
 > The minimal testcase:
 >
 > val socket = INetSock.UDP.socket ()
 > val () = Socket.bind (socket, INetSock.any 5432)
 >
 > Fails with: unhandled exception: SysErr: Invalid argument [inval]

The exception is being raised by INetSock.any, 
basis-library/net/inet-sock.sml:26.

It seems to me that the hton conversion should occur after the range 
check; however, doing so results in an exception on the echo.sml regression.

Rev 4333 (http://mlton.org/cgi-bin/viewsvn.cgi?rev=4333&view=rev) 
suggests that there are likely a number of places where we got the 
hton/ntoh conversions wrong.

You might consider moving the hton conversion in INetSock.any, but you 
may run into other exceptions.  To track them down, I suggest compiling 
with:
  -const 'Exn.keepHistory true' -profile-branch true -profile-raise true 
-profile-include '<basis>'

The exception history mechanism uses the profiling mechanism for 
tracking source locations.  By default, we don't include the Basis 
Library for profiling, but it is useful for tracking down exceptions 
raised in the Basis Library.  Similarly, tracking branches and explicit 
raises can help track down an exception more precisely.





More information about the MLton mailing list