net-ssh / net-scp

Pure Ruby implementation of the SCP protocol
http://github.com/delano/net-scp
MIT License
154 stars 63 forks source link

stop zlib warning if scp error occur #12

Closed byplayer closed 10 years ago

byplayer commented 10 years ago

If scp error occur, "zlib(finalizer): the stream was freed prematurely." message print to stderr. I stop it.

Change point is as follows. close ssh channel before raise

byplayer commented 10 years ago

I'm sorry, but I found bug. I close it.

delano commented 10 years ago

No problem. Glad you got it resolved.

qrohlf commented 10 years ago

@byplayer - what was causing your bug? I'm having the same issue with the zlib warning and error...

byplayer commented 10 years ago

In my case, I use Net::Scp with compress option and original file doesn't exist, zlib stream isn't closed. So, I try to close zlib stream, but it can't work properly.

So I try to find out zlib stream closing point.

By the way, I feel it is not good, zlib library print only stderr if it has warning, but I don't have good idea to know warning. Do you have good idea about it ? I want to send zlib patch to Ruby ML, if we find good way.

qrohlf commented 10 years ago

I was using Net::SCP with the compression option as well, and the issue seemed to only occur when transferring files from one specific machine (the other 28 machines in the cluster my program interacts with were just fine). I never ended up figuring out what was causing it, but it might be useful to know that conditions on the remote machine can be the cause of the error.

byplayer commented 10 years ago

@qrohlf - I understood. In your case, it is useful to know notice and different from my case.