opensmalltalk-vm icon indicating copy to clipboard operation
opensmalltalk-vm copied to clipboard

macOS sockets broken

Open eliotmiranda opened this issue 6 years ago • 4 comments

On macOS High Sierra 10.13.6 in 32-bit and 64-bit:

If NetNameResolver useOldNetwork == false then only 1 SocketTest test passes, 2 fail and 11 raise errors. The plugin reports connect errors, one for each error:

sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family sqConnectToAddressSize: Address family not supported by protocol family

If NetNameResolver useOldNetwork == true then only one test passes and there are 13 failures. Many (all?) fail with waitForConnectionFor:ifTimedOut:ifRefused: timing out. However, no errors are reported from the plugin.

eliotmiranda avatar Oct 02 '19 22:10 eliotmiranda

When using new network, the tests use an IPv6-based localhost address for binding and connecting.

The local socket is opened in setUp:

setUp

	listenerSocket := Socket newTCP listenOn: self listenerPort backlogSize: 4 interface: self listenerAddress.

The listenerAddress is derived as follows:

^ NetNameResolver addressForName: 'localhost'

In oldNetwork, that's an IPv4, in !oldNetwork that's an IPv6. this is good

However, the Socket is created as newTCP, that is, explicitely IPv4:

newTCP
	"Create a socket and initialise it for TCP"
	^self newTCP: SocketAddressInformation addressFamilyINET4

This is bad. This is where the Error message comes from.

This should be changed to use the address familty that fits best to the current old/new-network.

On top of that, #listenOn:backlogSize: interface: solely deals with IPv4 adresses.

The correct way is to use the indirection of SocketAddressInformation in #listenWithBacklog:. This deals correctly with the address family.

Things to do:

  • [ ] fix the test setup to use the SAI info and/or discriminate old/new network
  • [ ] maybe Bail in the socket plugin earlier when a new-network socket is used in old-network-ipv4-only code.

krono avatar Sep 17 '20 13:09 krono

wait, this is fixed?

krono avatar Oct 20 '20 06:10 krono

Oops. I was over optimistic. I assumed that Levente'se poll change applied to Mac. It doesn't. Mac needs kqueue. I'm reopening.

eliotmiranda avatar Oct 20 '20 17:10 eliotmiranda

marvelous :D

krono avatar Oct 20 '20 19:10 krono