NiclasOlofsson / MiNET

A (not so) basic Minecraft Pocket Edition server written in C#
Other
868 stars 197 forks source link

System.Net.Sockets.SocketException (55): No buffer space available #425

Open jarne opened 5 years ago

jarne commented 5 years ago

When starting MiNET, it throws the following error:

OS: macOS Mojave .NET core: 2.1.403

Are you blessed with HW accelerated vectors? Yep!
Operations timed using the system's high-resolution performance counter.
  Timer frequency in ticks per second = 1000000000
  Timer is accurate within 1 nanoseconds
 WARN [?] - No level.dat found at D:\Development\DOES NOT EXIST/level.dat. Creating empty.
 WARN [?] - No level.dat found at D:\Development\DOES NOT EXIST/level.dat. Creating empty.
 WARN [?] - No level.dat found at D:\Development\DOES NOT EXIST/level.dat. Creating empty.
 WARN [?] - We overslept -11ms in thread sleep
ERROR [?] - Error during startup!
System.Net.Sockets.SocketException (55): No buffer space available
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
   at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Int32 optionValue, Boolean silent)
   at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Int32 optionValue)
   at System.Net.Sockets.Socket.set_ReceiveBufferSize(Int32 value)
   at MiNET.MiNetServer.CreateListener() in /Users/jarne/Downloads/MiNET/src/MiNET/MiNET/MiNetServer.cs:line 234
   at MiNET.MiNetServer.StartServer() in /Users/jarne/Downloads/MiNET/src/MiNET/MiNET/MiNetServer.cs:line 195
MiNET running. Press <enter> to stop service.

I'm not able to connect to the server.

NiclasOlofsson commented 5 years ago

That's a new one. Have to look into that. I wonder if it is trying to set the socket options, when it really shouldn't do it on any other OS than Windows.

undrfined commented 5 years ago

@NiclasOlofsson it sets ReceiveBufferSize to int.Max before platformId check so that's the problem. Probably should be moved into that if statement. image

NiclasOlofsson commented 5 years ago

Should probably check to see if it can give me a proper max size for the platfom in question.

Guillaume351 commented 5 years ago

Hello, I have the same issue on the same OS. Is there a workaround I could use in the meantime ? Thanks

EDIT; I moved the lines pointed out by undrfined, seems to work

tpurtell commented 5 years ago

OS X max seems to be 7280*1024 for me.

mikroskeem commented 4 years ago

OSX does not support DontFragment either (on Catalina atleast)

NiclasOlofsson commented 4 years ago

Then i would say OSX is a security risk. It's a pretty common attack vector to framgent messages on UDP. And it's really difficult to spot since the IO won't communicate it outside of the "kernel" sort of.

kennyvv commented 2 years ago

Is this still an issue? Do we need to look into this or do we mark this as won't fix? @NiclasOlofsson