commit | d36967415b521f4f3c1cc4ac2ad8fa1ac02507c9 | [log] [tgz] |
---|---|---|
author | Todd Wang <toddw@google.com> | Mon Jan 18 13:53:53 2016 -0800 |
committer | Todd Wang <toddw@google.com> | Mon Jan 18 13:53:53 2016 -0800 |
tree | 65e62bdc8737aec582133417dd96a0cb2039faea | |
parent | 673c7717bf86a8a67eda09302c1b67cc5eddeb89 [diff] |
gosh: Exit signal-handling goroutine on Cleanup, other cleanups. I noticed while running tests that we had a bunch of termination signal handler goroutines running. It's better to clean up these goroutines, since they do take up some resources, and more importantly, clutter up the stack traces on failure. The new logic shuts down the goroutine when cleanup is called. It's hard to write a test to verify this, since Go doesn't provide a way to detect that a goroutine has finished. So I don't have a test. I also did some minor reorganizing to get better stacktraces from the goroutines spawned by gosh; basically making sure we had named functions in the stacktrace to help debugging. I also noticed that sh.dirStack is used in cleanup, so we need to ensure sh.cleanupMu is locked when touching it. I think I missed this when I added the dirStack to the cleanup. Finally, I noticed that TestSignal and TestTerminate are flaky, because of a race between the child process installing the signal handler, and the test process sending the signal. I added some synchronization to avoid this race, and also changed to children to sleep for 1 hour rather than 1 second, since we're trying to test the case where they haven't exited yet. Change-Id: I73a080e781008a1fdcf3401b41d2d5b84e108560
This repository contains general purpose libraries used by the Vanadium project. TEST