Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libssh2-hs can't send 3megabyte file #10

Open
aycanirican opened this issue Apr 12, 2013 · 3 comments
Open

libssh2-hs can't send 3megabyte file #10

aycanirican opened this issue Apr 12, 2013 · 3 comments

Comments

@aycanirican
Copy link

I am able to send small files but libssh2 blocks when I try to send a 3mb file.

@grpala
Copy link

grpala commented Apr 20, 2013

It's not just 3MiB... a 180KiB file blocks it too... I've been trying to fix this for the past 3 hours, got no results yet. HELP!

@grpala
Copy link

grpala commented Apr 21, 2013

OK, found the bug. I'd submit a pull request but I'm not sure of the correctness of my fix. The problem is as follows:
When sending a file and the server replies an EAGAIN (this doesn't happen for very small files), threadWaitSession will first block the thread waiting for read, but since there's nothing to read whatsoever it blocks forever.

I made transfers work (https://gist.github.com/5428276) but this doesn't feel all right since there are 3 possible states for session direction: [INBOUND], [OUTBOUND], [INBOUND, OUTBOUND] (as seen in int2dir).

During file transfers, the observed direction is the latest, and in this case it only needs to threadWaitWrite, but what if there were a case where it needed to threadWaitRead too? This "fix" would undoubtedly break.

In any case, take this patch as a proof of concept as to where the bug is.

portnov pushed a commit that referenced this issue Mar 19, 2016
@portnov
Copy link
Owner

portnov commented Mar 19, 2016

Applied that patch to master for now. If anyone has better solutions, you are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants