Bug: lprun stuck forever when the query has already finished
The hang occurs when there is an unclosed external resource. The linqpad doesn't get stuck because it doesn't unload the application domain and therefore does not wait for the process to exit completely.
There should be some sort of a timeout for the registration of the query exited event and the finilizers to finish their job. If they don't finish in a timely manner you need to kill the process forcefully.
We were using https://github.com/sshnet/SSH.NET and didn't call .Exit() everywhere.
This produces the hang of sorts:
<Query Kind="Statements">
<Reference Relative="..\..\SSH\Renci.SshNet.dll">C:\Users\User\Desktop\SSH\Renci.SshNet.dll</Reference>
<Namespace>Renci.SshNet</Namespace>
</Query>
var sshClient = new SshClient("demo.wftpserver.com", 2222, "admin", "root");
sshClient.Connect();
var command = sshClient.RunCommand("test");
command.Result.Dump();
Then call:
lprun ssh.linq
<-- dreadful hang is right here
-
Denis Valeev commented
TCP/IP tab of Sysinternal's Process Explorer of the lprun process shows an active tcp connection in the forever CLOSE_WAIT state. Seems like lprun waits for that to clear up. Which will never happen.
-
Denis Valeev commented
Stuck in Server.Cancel somewhere