Skip to content

Commit

Permalink
Improve suicide
Browse files Browse the repository at this point in the history
  • Loading branch information
episource committed Mar 8, 2019
1 parent 2a5e7c8 commit fd439e8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions episource.unblocker/hosting/WorkerServer.cs
Expand Up @@ -248,10 +248,20 @@ public sealed partial class WorkerServer : MarshalByRefObject, IWorkerServer {
// kill current worker in the most robust way possible!
try {
this.ServerDyingEvent.InvokeEvent(e => e(this, EventArgs.Empty));
} catch (Exception ex) {
// continue on any possible remoting error
// most likely: remoting error

Console.WriteLine(this.serverId + " Failed to announce suicide: " + ex.Message);
Console.WriteLine(ex.StackTrace);
}

try {

Process.GetCurrentProcess().Kill();
} catch (Exception exx) {
Console.WriteLine(this.serverId + " Failed to commit suicide: " + exx.Message);
Console.WriteLine(exx.StackTrace);
} catch (Exception ex) {
Console.WriteLine(this.serverId + " Failed to commit suicide: " + ex.Message);
Console.WriteLine(ex.StackTrace);
Console.WriteLine(this.serverId + " Client will have to take care of that!");
}
}
Expand Down

0 comments on commit fd439e8

Please sign in to comment.