Search Issue Tracker

By Design

Votes

0

Found in

5.3.4f1

Issue ID

780580

Regression

Yes

[Debug] Running project with attached debugger causes Socket exception if Socket is in another thread

CodeEditors

-

Steps to reproduce:

1. Open attached project
2. Open scene "1"
3. Run it and notice "Thread Start!" message in console
4. Open IPC.cs script using Visual Studio (or MonoDevelop) and attached debugger
5. Run scene again
6. In console, notice Socket Exception: System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall.

Note: Doesn't happen if socket is running from the main thread (Update)

Workaround: Don't attach debugger

Not reproducible: 5.2.4f1
Reproduced with: 5.3.0f4, 5.3.4f1, 5.4.0b11

Comments (7)

  1. sebrk_hiq

    Sep 26, 2017 19:48

    God I'm sick of these "By design" answers without any further explanation. I'm running the listener in main thread and still get this error.

  2. tabulatouch

    Jan 17, 2017 22:06

    I found i could only handle server connections creating and starting a TcpListener first, then using this in the Update:

    if (listener.Pending()) {
    var nativeClient = listener.AcceptTcpClient();
    ...
    }

    This way the server smoothly accepts and handles requests.

  3. danielhouston

    Nov 17, 2016 03:22

    @TapioFragment I have tried your workaround using listener.BeginAcceptSocket() but when I call listener.EndAcceptSocket() I get the same WSACancelBlockingCall exception. Do you have that problem still or does it work for you?

  4. tapiofragment

    Oct 27, 2016 06:21

    I found that blocking on AcceptTcpClient gets interrupted and the workaround for that is as easy as using BeginAcceptTcpClient and blocking instead on AsyncWaitHandle.WaitOne.

  5. Jung-DongHun

    Oct 20, 2016 06:09

    No way...

  6. Protectator

    Aug 23, 2016 11:56

    How is "Do not use the debugger anymore" a workaround ? Ain't there an other realistic option ?

    Also, some details of why is this ok by design would be helpful.

  7. B16B0SS

    Jul 05, 2016 12:33

    This workaround isn't very realistic. How can I debug my server with this?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.