SocketPlugin issues (was: Re: [Vm-dev] Win32 beta test)

Levente Uzonyi leves at elte.hu
Mon Sep 17 17:01:47 UTC 2012


On Mon, 17 Sep 2012, David T. Lewis wrote:

> Levente,
>
> Can you say anything more about what weakness you found in the
> network code?

All issues I found are related to name lookup. To do a name lookup the new 
code requires multiple primitive calls (see SocketAddressInformation >> 
#forHost:service:flags:addressFamily:socketType:protocol:). The plugin 
uses static variables to store the result of the name lookup 
(hostNameInfo, servNameInfo and nameInfoValid). This means that only one 
name can be looked up at a time.

The image side code doesn't prevent simultaneous access to these static 
variables, so the can get into an unexpected state (see SocketAddress >> 
#hostName).

Another issue is that the plugin doesn't allocate objects (strings), so 2 
primitive calls have to be done to fetch a string (see SocketAddress >> 
#hostName again). One requests the size of the string, the other copies 
the data to a string it receives as argument.

I could reproduce a deadlock-like state by evaluating:

NetNameResolver addressesForName: 'amazon.com'

It's sometimes possible to interrupt the process to get a debugger, but 
since the primitives are called by the debugger too (see SocketAddress >> 
#printOn:), the image will hang if you try to use it.


Levente

>
> Thanks,
> Dave
>
>


More information about the Vm-dev mailing list