Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Brezae <brezaevlad@gmail.com>2019-09-26 15:40:42 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2019-09-26 15:40:42 +0300
commit4a17f5ca11aea146977924df70442c20dcb63bd4 (patch)
treece4a35f2375415546b79f7cc629a1c3553836de6 /mcs/class/Mono.Debugger.Soft
parent9b094e660c89eb43ee7d24368711694279bd3b9e (diff)
[Mono.Debugger.Soft] Fix VirtualMachine detaching (#17020)
* Revert "[Mono.Debugger.Soft] Properly close connections" This reverts commit 2da77073731dc88cfef40ed5a838e53896eca7d1. This was previously reverted because it was causing issues and it still does. It is a hack fix. We signal the connection for closing and next we send the dispose command over the network. This is obviously racy. * [Mono.Debugger.Soft] Make sure receiving thread always closes When we want to close the connection, setting the close flag is not enough, because a thread can be already stuck in a blocking receive, without getting to check the flag. We fix this by additionaly breaking the connection, by using socket.Shutdown. Fixes https://github.com/mono/mono/issues/7377 * Bump API snapshot submodule
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs8
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs5
2 files changed, 12 insertions, 1 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
index 7e895773bc2..3e2cf5f33af 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
@@ -1318,6 +1318,8 @@ namespace Mono.Debugger.Soft
protected abstract int TransportSend (byte[] buf, int buf_offset, int len);
protected abstract void TransportSetTimeouts (int send_timeout, int receive_timeout);
protected abstract void TransportClose ();
+ // Shutdown breaks all communication, resuming blocking waits
+ protected abstract void TransportShutdown ();
internal VersionInfo Version;
@@ -1434,6 +1436,7 @@ namespace Mono.Debugger.Soft
internal void Close () {
closed = true;
+ TransportShutdown ();
}
internal bool IsClosed {
@@ -2865,6 +2868,11 @@ namespace Mono.Debugger.Soft
{
socket.Close ();
}
+
+ protected override void TransportShutdown ()
+ {
+ socket.Shutdown (SocketShutdown.Both);
+ }
}
/* This is the interface exposed by the debugger towards the debugger agent */
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
index 1912626d228..c9026a02682 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
@@ -150,8 +150,11 @@ namespace Mono.Debugger.Soft
}
public void Detach () {
- conn.Close ();
+ // Notify the application that we are detaching
conn.VM_Dispose ();
+ // Close the connection. No further messages can be sent
+ // over the connection after this point.
+ conn.Close ();
notify_vm_event (EventType.VMDisconnect, SuspendPolicy.None, 0, 0, null, 0);
}