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

Problems running watcher in a thread #39

Closed
rehevkor5 opened this issue Dec 20, 2012 · 3 comments
Closed

Problems running watcher in a thread #39

rehevkor5 opened this issue Dec 20, 2012 · 3 comments

Comments

@rehevkor5
Copy link

I have a test that starts a watcher in a thread (via guard/listen), sleeps, and then makes a file change that the watcher should pick up.

About 90% of the time, it appears that the watcher never even gets set up, for some reason I can't determine.

However, when it does get set up, it never terminates. The fsevent_watch process remains running even after I have killed the thread. This means that my Ruby process also remains running.

What is the proper way to ensure termination of that process (and thereby my Ruby process)?

Thanks for any help you can provide.

@ttilley
Copy link
Member

ttilley commented Dec 21, 2012

The code is using IO.popen to interact with the subprocess, which i'm assuming uses an rb_ensure c api call to wait on process termination and prevent it from becoming a zombie. if you kill the thread, i don't think rb_ensure hooks (or normal ruby ensure blocks) get called.

😕

Are you able to share a reduced test-case as an example?

@ttilley
Copy link
Member

ttilley commented Dec 28, 2012

you may be interested in testing against master due to a recent merge: #40

@rehevkor5
Copy link
Author

Permit me to beg your forgiveness for mistaking my own problem for a problem with your gem. I was confused as to why the listener process remains running even after Ruby should no longer be using it. The real problem, however, was my app creating a pidfile, and since rspec doesn't fork, the pidfile wasn't getting released after each test. Thus, subsequent tests were blocked on locking the pidfile. I factored out the pidfile stuff and now everything is normal.

For me, the issue is resolved. However, if you would like to pursue the threading issue let me know and I will provide you with demonstration code.

@ttilley ttilley closed this as completed Dec 29, 2012
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

2 participants