Comments (14)
Should the line ClientWindowSize -= packetSize;
be present?
from fxssh.
Could please tell me how to re-produce this issue? What's client tool used? Please debug & watch the ClientInitialWindowSize
and ClientMaxPacketSize
on FxSsh.Services.Channel.cs
from fxssh.
Did you send large data (>ClientInitialWindowSize) at the message loop thread? In another word, did you send this data in service_CommandOpened
event?
If yes. Yes , it is TURE make message blocking, going to dead lock.
from fxssh.
Hi, @xucito
Do you have more question?
from fxssh.
Hi @Aimeast any data sent via the SendData function will cause this deadlocking. I did send it via the service_CommandOpened event. I have fixed it by removing the ClientWindowSize packetsize subtraction.
from fxssh.
Hi @xucito
Please not do this. This will break flow-control mechanisms and may cause network more jam.
The right way is create new Threading or Task to send BIG message on service_CommandOpened event.
from fxssh.
Interesting, should it not close the session then? The behavior where it hangs seems incorrect. Can you link to me where you got the 1MB limitation or the Client Window Size limitation, I am using SSH based tools that hit the limitation quite easily so I am assuming that there is some incorrect behavior in the ssh implementation.
from fxssh.
In design, we can't fix it without redesign. Client Windows Size is send from Client, Server side must observe it.
A way to fix it shall re-design message loop, split message loop to message read thread and handle thread.
from fxssh.
Hi @xucito
Please try https://github.com/Aimeast/FxSsh/tree/fix24
from fxssh.
So that seems to work however I am encountering a new issue as a result of the fix you posted:
Seems that when you handle the invoke DataReceived, it is possible for the thread to continue without the full message being acknowledged by the client?
The loop below will sometimes not send the entire message before proceeding to send the closed
foreach (var section in splitResult)
{
DataReceived?.Invoke(this, Encoding.ASCII.GetBytes(section));
}
CloseReceived?.Invoke(this, 0);
foreach (var section in splitResult)
{
DataReceived?.Invoke(this, Encoding.ASCII.GetBytes(section));
Thread.Sleep(500); //This line fixes it
}
CloseReceived?.Invoke(this, 0);
I do not know whether it is a coincidence but I did not have this issue before using my bad fix
from fxssh.
I have tested following code in program.cs service_CommandOpened
, no issue found. Could you please tell how do you test and the scene. e.g. the length of section
, length of splitResult
, condition of network is fast or slow network?
var rnd = new Random();
for (int i = 0; i < 10000; i++)
{
e.Channel.SendData(Encoding.ASCII.GetBytes(rnd.Next().ToString()));
}
from fxssh.
So this issue is observed when I have some latency (even if its not very much) between the server the client.
When I run both server and client on same machine, I don't encounter the issue, when I have the server and client on their own machines I get the following kinds of errors errors:
OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 25163\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 10.10.10.16 closed.\r\n
The errors indicate that the client was expecting the rest of the message but received the exit signal.
When I add the sleep, it no longer has this issue.
from fxssh.
I have updated https://github.com/Aimeast/FxSsh/tree/fix24 to test via My phone JuiceSSH client over 20+ times, the test goes to send a big random text. There are no any issues found.
var rnd = new Random();
for (int i = 0; i < 1000; i++)
{
var str = "";
for (int j = 0; j < 100; j++) // size tested from 100 to 3000
{
str += rnd.Next().ToString();
}
e.Channel.SendData(Encoding.ASCII.GetBytes(str));
}
So, can you exactly description how reproduce you issue. Including client name & version, server side simplified code, data size and so on.
from fxssh.
Let's close this for now, my client is actually a Ansible OpenSSL client. I will create a different issue when I write a test to reproduce and can reliably replicate this. Thanks for all the help
from fxssh.
Related Issues (20)
- Publish new version to NuGet HOT 2
- Automated tests HOT 2
- Reverse tunneling
- Request method to clear host key interface. HOT 2
- Hope could be a strong name signed version in nuget HOT 2
- Connection closes HOT 3
- Questionable SSH_MSG_UNIMPLEMENTED handling HOT 17
- Repeated call of Disconnected event HOT 1
- Critical security issue HOT 24
- Channel always forces close when sending SSH_MSG_CHANNEL_CLOSE
- Feature under subsystem HOT 1
- Elliptic Curve cryptography HOT 5
- Session gets closed very quickly HOT 4
- What the host key xml format? HOT 1
- When terminal windows resize, outputs are weird HOT 4
- Publish version 1.1.2 to NuGet HOT 1
- any sample for FxSsh.PwAuth HOT 3
- Unable to negotiate HOT 2
- Strict Key Exchange to Mitigate Terrapin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fxssh.