Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Operation on non-blocking socket would block" on Fishnet bayou #13

Open
celojevic opened this issue Aug 25, 2024 · 2 comments
Open

"Operation on non-blocking socket would block" on Fishnet bayou #13

celojevic opened this issue Aug 25, 2024 · 2 comments

Comments

@celojevic
Copy link

Hello there,

I'm getting this error quite often in my project. Im using FishNet's Bayou transport which is just a wrapper for this git.

2024-08-25T09:03:25.360622052Z Rethrow as IOException: Unable to read data from the transport connection: Operation on non-blocking socket would block.

2024-08-25T09:03:25.360627003Z   at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000ac] in <68069378c72d45228fc9d977cd8eee2c>:0

2024-08-25T09:03:25.360633291Z   at JamesFrowen.SimpleWeb.ReadHelper.Read (System.IO.Stream stream, System.Byte[] outBuffer, System.Int32 outOffset, System.Int32 length) [0x00004] in <856293134615445bb2bef1c6207332cf>:0

2024-08-25T09:03:25.360638866Z   at JamesFrowen.SimpleWeb.ReceiveLoop.ReadHeader (JamesFrowen.SimpleWeb.ReceiveLoop+Config config, System.Byte[] buffer, System.Boolean opCodeContinuation) [0x0002a] in <856293134615445bb2bef1c6207332cf>:0

2024-08-25T09:03:25.360644081Z   at JamesFrowen.SimpleWeb.ReceiveLoop.ReadOneMessage (JamesFrowen.SimpleWeb.ReceiveLoop+Config config, System.Byte[] buffer) [0x0002c] in <856293134615445bb2bef1c6207332cf>:0

I'm not sure what it means or how to fix it honestly. The only googling i could do says it has to do with threads. Would using Tasks instead of Threads help?

Any help or advice would be appreciated!

@James-Frowen
Copy link
Owner

I think that error is thrown when a socket is set to non-blocking mode. but I dont think we change the Blocking property anywhere, and it should default to true.

for some background: the Read call should block the current thread until there is new data, which is why there are many side threads. Using tasks for read/write calls in unity has much worse performance.

FishNet's Bayou has some modifications to the source code, so it is possible those changes are causing issues.

@celojevic
Copy link
Author

I cant seem to find the Blocking property anywhere so I can probably assume its also not being changed. And at least my FN package has no modifications to your source code since i also tried updating SWT to the latest 2.2.1.

I am hosting on Playflow, not sure if that makes a difference.

I'm also having other issues with the web transport. Have asked in the FN discord as well but still can't figure out what's going on with any of this. I'm wondering if we can talk on Discord about it? Would gladly pay you for your time as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants