Deadlock problems with send function - WeOnlyDo Discussion board

Deadlock problems with send function (wodWebServer / wodWebServer.NET)

by Marian, Saturday, May 08, 2010, 08:37 (5092 days ago)

Hello,
I'm using the SSH.net component for Telnet and SSH communications.
I'm using a none blocking type, and I get very bad results when using Telnet protocol.
I have a textbox with a KeyDown event, and when ever I press a key for a few seconds (and calling the SSH.Send(..) function for each event) my main thread gets blocked.
When looking at the stacktrace, I get:
[code]
[In a sleep, wait, or join] WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) + 0x26 bytes
mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) + 0x1a bytes
[Native to Managed Transition]
[Managed to Native Transition]
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Protocols.SSH.MethodNotification(System.IAsyncResult ar) + 0x70 bytes
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Protocols.SSH.SendNotification(System.IAsyncResult ar) + 0xc6 bytes
System.dll!System.Net.LazyAsyncResult.Complete(System.IntPtr userToken) + 0x69 bytes
System.dll!System.Net.ContextAwareResult.CaptureOrComplete(ref System.Threading.ExecutionContext cachedContext, bool returnContext) + 0xab bytes
System.dll!System.Net.ContextAwareResult.FinishPostingAsyncOp(ref System.Net.CallbackClosure closure) + 0x3c bytes
System.dll!System.Net.Sockets.Socket.BeginSend(byte[] buffer, int offset, int size, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode, System.AsyncCallback callback, object state) + 0xef bytes
System.dll!System.Net.Sockets.Socket.BeginSend(byte[] buffer, int offset, int size, System.Net.Sockets.SocketFlags socketFlags, System.AsyncCallback callback, object state) + 0x23 bytes
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Net.Sockets.FileSocket.BeginSend(byte[] buffer, int offset, int size, System.Net.Sockets.SocketFlags socketFlags, System.AsyncCallback callback, object state) + 0x6f bytes
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Protocols.SSH.SendPacket(ref byte[] data, int start, int len) + 0x27a bytes
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Protocols.SSH.Send() + 0x10a bytes
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Protocols.SSH.Send(ref byte[] Data, int Offset, int Len) + 0x42b bytes
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Protocols.SSH.Send(ref byte[] Data) + 0x30 bytes
WeOnlyDo.Client.SSH.dll!WeOnlyDo.Client.SSH.Send(byte[] Data) + 0x2b bytes
[/code]
I would appreciate your quick response.

Re: Deadlock problems with send function

by Marian, Saturday, May 08, 2010, 08:38 (5092 days ago) @ Marian

By the way, the problem does not exist when connecting with the SSH protocol.

Re: Deadlock problems with send function

by woddrazen, Saturday, May 08, 2010, 11:13 (5092 days ago) @ Marian

Hi Marian,


I try to duplicate your problem but it works for me with SSH and Telnet protocol.

Is there any chance you can try our Terminal CS or Terminal VB sample in component Samples folder?

Does ti work there or you still receive your problem?


Regards,
Drazen

Re: Deadlock problems with send function

by Marian, Saturday, January 15, 2011, 00:43 (4840 days ago) @ woddrazen

Dear Drazen,
Sorry for replying just now, I've been working on a different project lately but now I'm back. [:happy:]

The problem occurs on the Terminal CS sample as well.
In order to reproduce the problem:
1. Make a 10MB text file on a linux machine.
2. Connect to it using Telnet
3. Execute a cat [file] command for printing the file to console
4. Press Ctrl+C for breaking the printing.

At this point the application will get into a dead lock on the SSH.Send method.

I hope you can solve this soon [:doh:]
Kind regards.
Marian

Re: Deadlock problems with send function

by woddrazen, Saturday, January 15, 2011, 12:24 (4840 days ago) @ Marian

Hi Marian,


This worked for me without any problem. Can you maybe send us email to techsupport@weonlydo.com

We will send you there access to our linux server. So maybe we can try to recreate your probem there.


Regards,
Drazen

Re: Deadlock problems with send function

by Marian, Saturday, January 15, 2011, 12:44 (4840 days ago) @ woddrazen

I have send you an email.
Thanks for the quick response.

Re: Deadlock problems with send function

by Marian, Saturday, January 15, 2011, 18:04 (4839 days ago) @ Marian

Hi Drazen,
I uploaded a file called bigfile.txt
and when i execute the command 'cat bigfile.txt' and press a few keystrokes while the file is printed, the application hangs.

it might not hang on the first time, but try it a few times.

Please let me know if you're able to reproduce it.
If not, I don't mind letting you remote control my pc and check for yourself.

Kind regards,
Marian.

Re: Deadlock problems with send function

by woddrazen, Sunday, January 16, 2011, 10:24 (4839 days ago) @ Marian

Marian,


Your problem should be fixed. Can you please request update and try it again?

in order to get update for our product, please go to:

http://www.weonlydo.com/index.asp?update=1

This is automated process. Make sure you use same email address that is registered with our system, one you used when you have purchased the product.

Let us know how it goes.


Drazen

Re: Deadlock problems with send function

by Marian, Sunday, January 16, 2011, 18:51 (4838 days ago) @ woddrazen

Hello Drazen
Thanks for fixing it so quickly, but I'm currently using a trial version.
Is the current trial version available on the website is updated as well?

Thanks
Marian

Re: Deadlock problems with send function

by woddrazen, Sunday, January 16, 2011, 18:53 (4838 days ago) @ Marian

Marian,


Yes, you can download latest trial version from our website here:
http://www.weonlydo.com/Samples/wodSSH.NET.msi


Drazen

Re: Deadlock problems with send function

by Marian, Sunday, January 16, 2011, 22:17 (4838 days ago) @ woddrazen

Thank you very much, the problem seems to be solved.
We will continue our development using your component and if everything goes well, we will place an order within a few weeks.

Many thanks for the help,
Marian.

Re: Deadlock problems with send function

by woddrazen, Sunday, January 16, 2011, 23:44 (4838 days ago) @ Marian

Marian,


Excellent! We are happy to hear such good news.

If you need any other help please don't hesitate to ask. We are here to help you.


Drazen