Comments (10)
Thank you. Sorry, haven't been very active in this repo for a long time.
from sambal.
Thank you.
from sambal.
I noticed that the solution I proposed has a problem because it leaves a zombie process.
After running the test that I posted before I see something like:
$ ps ax | grep sh
....
1357 pa- Z 0:00.00 (sh)
I found a solution, and wish to send a pull request shortly.
from sambal.
Thanks for merging #9
from sambal.
@johnae Could you make a release with this fix? We're running into this in production. Until then, I'll point at the commit.
Thanks!
from sambal.
@will-in-wi I'm fairly certain 0.1.7 which was released on january 19th includes this. Are you saying it's still an issue?
from sambal.
I just realized that it was indeed released. Yes, this is still an issue. I'm running the latest commit from master on a CentOS 6 box, and the commands hang around after the process is finished.
I'm looking into it…
from sambal.
Turns out that our issue is that we never call Sambal::Client#close
. I made the mistake of assuming automatic resource cleanup.
from sambal.
Aha I see. I guess that could be implemented, though it should be quite easy to wrap up from outside too. I always considered this to be more of a low-level library. But, as with File, it could be done in using blocks I suppose.
from sambal.
I thought about that for a while, and I'm fine either way. Having block syntax would probably be good and remind consumers of the API that they need to clean up if they don't use the syntax.
Another option I looked into was the usage of finalizers, so that it would be closed on GC. However, in our infrequent access server case (Rails under Passenger), GC didn't run often enough to make a difference (or at least not enough to not annoy our server admins).
The part that I found unexpected is that it seems possible (untested) to instantiate the class (which opens a connection), call close, and then call other methods on it, which it seems would break since the instantiation code isn't re-called. It might be worth looking at a model where the client creation code was moved into a private method which is called before each public method and is a noop if it is already active. This way, all of the methods always work…
I've fixed it for my case, but I'm happy to help think through a better API (and maybe send a PR) if desired.
Thanks for this gem! It certainly made an odd case I ran into much easier.
from sambal.
Related Issues (18)
- Problems with Exception (Failed to do cd "path"); HOT 1
- I have problem running on OpenBSD/adJ 5.8 HOT 1
- Need a better test infrastructure
- Remote file md5sum HOT 2
- `rescue in initialize': Unknown Process Failed!! (Input/output error - /dev/ttys002) HOT 6
- Doesn't work on Windows; cannot load such file pty HOT 4
- Doesn't connect if options[:host] != default_options[:host] HOT 1
- Password is passed to smbclient via plaintext on the command line HOT 3
- If client fails to connect, `#exit(1)` is called instead of raising an error HOT 2
- Unknown Process Failed exit HOT 3
- Doesn't handles files with consecutive whitespace characters HOT 1
- Is their an equivalent method to File.stat HOT 1
- new rubygem version HOT 2
- `brew install samba` does not work anymore HOT 1
- File without any flags is not listed by ls HOT 2
- Smbclient response when trying to cd to a non-existing directory HOT 1
- Failing to use sambal command on irb console / rails console HOT 8
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 sambal.