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

Fixed random test failure in Watchman watchers #113

Closed
wants to merge 4 commits into from
Closed

Fixed random test failure in Watchman watchers #113

wants to merge 4 commits into from

Conversation

dcombslinkedin
Copy link
Contributor

The recent updates to WatchmanWatcher contained a bug where when the test harness told a watcher to close down, it would tell the new WatchmanClient to remove the watcher from the listeners, but forgot to pass the WatchmanWatcher instance so nothing was getting closed/removed, resulting in spurious events later because the listener hadn't been removed.

…r that also reduced the number of direct clients of watchman.Client to 1 per process
… the instance to close into WatchmanClient, resulted in spurious events

// Define a handler for if somehow the Node process gets interrupted. We need to
// close down the watchman.Client, if we have one.
process.on('SIGINT', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues:

  • This can leak memory. If a sane session using watchman is no longer being used, it will be retained by the process.on('SIGINT' handler until the process shutdown (or SIGINT) is worked
  • This wont handle other forms of shutdown, such as the process simply ending when it has no more work to do.

Ideas to resolve:

  • the global cleanup handler needs to be disabled via off during WatchmanWatcher.prototype.close
  • use capture-exit to handle all reasonable forms of exit + cooperation with other libraries attempting to do the same.

@stefanpenner
Copy link
Collaborator

stefanpenner commented Feb 8, 2018

  • I have cherry-picked the test failure this PR fixes -> fixed test failure #114
  • This PR can become focused around ensuring WatchmanClients are not leaked

@dcombslinkedin
Copy link
Contributor Author

I created a separate PR (#119) for the exit handling, since this PR shows as 'unknown repository'. I'll close this PR now.

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

Successfully merging this pull request may close these issues.

2 participants