{"push_id":1216258869,"size":6,"distinct_size":6,"ref":"refs/heads/master","head":"8b2f78acb4cc19a5ec4c9bbb8a60f97911d33d3c","before":"58902aa38f8ba33bb92915a35f577b7b12208a4c","commits":[{"sha":"7077fb72bb0c43887c0f5f49f9ee56a24c8cc6ed","author":{"name":"micbou","email":"1927999686014308dead34c1cfcb9d8bd5271589@micbou.com"},"message":"Add server management tests\n\nTest if server and subservers are properly shut down from a handler\nor the watchdog plugin. By using a handler, we have a portable way\nto properly shut down the server from a client.","distinct":true,"url":"https://api.github.com/repos/Valloric/ycmd/commits/7077fb72bb0c43887c0f5f49f9ee56a24c8cc6ed"},{"sha":"2df3ed293b232f3d7d0af951c756bfa5b6f78bbe","author":{"name":"micbou","email":"1927999686014308dead34c1cfcb9d8bd5271589@micbou.com"},"message":"Enable Python subprocesses coverage","distinct":true,"url":"https://api.github.com/repos/Valloric/ycmd/commits/2df3ed293b232f3d7d0af951c756bfa5b6f78bbe"},{"sha":"d233603727817f1c976d6800675cb3e79356411d","author":{"name":"micbou","email":"1927999686014308dead34c1cfcb9d8bd5271589@micbou.com"},"message":"Update Waitress to 0.8.10\n\nBy switching from the low-level Python thread module to the threading\nmodule in 0.8.10, Waitress is now correctly traced by coverage.py.\nSince some of our tests are using Waitress to start a WSGI app, we\nare updating it to fix this coverage issue.","distinct":true,"url":"https://api.github.com/repos/Valloric/ycmd/commits/d233603727817f1c976d6800675cb3e79356411d"},{"sha":"65f524ee6958bf41d95a9fec708b22a032711488","author":{"name":"micbou","email":"1927999686014308dead34c1cfcb9d8bd5271589@micbou.com"},"message":"Add shutdown handler","distinct":true,"url":"https://api.github.com/repos/Valloric/ycmd/commits/65f524ee6958bf41d95a9fec708b22a032711488"},{"sha":"ed23b23fbf8fe32cb2f305d0719ebd6c8fee41c1","author":{"name":"micbou","email":"1927999686014308dead34c1cfcb9d8bd5271589@micbou.com"},"message":"Update client example","distinct":true,"url":"https://api.github.com/repos/Valloric/ycmd/commits/ed23b23fbf8fe32cb2f305d0719ebd6c8fee41c1"},{"sha":"8b2f78acb4cc19a5ec4c9bbb8a60f97911d33d3c","author":{"name":"Homu","email":"d19a5ab8a9949b703fb53ed7faafd416a5b1e0ba@barosl.com"},"message":"Auto merge of #282 - micbou:shutdown-tests, r=puremourning\n\n[READY] Properly shut down on Windows\n\n### Problem\n\nWhen killing a process on Windows, it is terminated like it received a `SIGKILL` signal on Linux. This means that @atexit functions will not be called. In our case, `ServerCleanup` is not executed:\ncompleters `Shutdown` methods are not called, neither the `Shutdown` function in the global extra conf. In particular, subservers like `OmniSharpServer` and `Tern.js` are left running.\nThis issue happens in two situations:\n - [a client like YCM terminates the ycmd server](https://github.com/Valloric/YouCompleteMe/blob/master/python/ycm/youcompleteme.py#L175);\n - [watchdog plugin pulls the trigger](https://github.com/Valloric/ycmd/blob/master/ycmd/watchdog_plugin.py#L92).\n\nHow to solve it?\n\n### Solution\n\nFirst situation should be solved by adding a new handler `/shutdown` to properly shut down the ycmd server from a client. Unfortunately, `waitress` and `bottle` don't provide an easy way to shut it down. Using `sys.exit()` in the `/shutdown` handler will not work because it is run in a thread. The solution is to use the same mechanism as in the watchdog plugin. After cleaning up, we start a thread to immediately kill the server.\nSecond situation is fixed by using the function associated to the `/shutdown` handler in the watchdog plugin.\n\n### Tests\n\nTo test that the shutdown handler and the watchdog plugin are properly working, we need to start the ycmd server for real. We cannot use [webtest](https://webtest.readthedocs.org/en/latest/) here. I added 4 tests, which are a combination of shutting down ycmd without and with a subserver, from a request and from the watchdog plugin.\n[psutil](http://pythonhosted.org/psutil/) module was added to the test requirements to work with processes in a portable way.\nIn order to test the watchdog plugin, I added a command-line argument to set the `check_interval_seconds` variable.\nSince we are starting subprocesses in those tests, some changes were needed to enable coverage in Python subprocesses. Another change to improve coverage was to update Waitress to version 0.8.10. See the commit message for some explanation.\nA benefit of those tests is a significant increase in coverage (~6%).\n\n###  Caveats\n\n- Tests may introduce flakyness. Robustness should be improved;\n- Coverage seems to cause issue with the Gocode daemon. Not sure if it is related to this PR. Need to investigate.\n\n### Next\n\n- Update YCM to use the `shutdown` handler (fix issue Valloric/YouCompleteMe#876);\n- Fix logfiles clean up on Windows.\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/valloric/ycmd/282)\n<!-- Reviewable:end -->","distinct":true,"url":"https://api.github.com/repos/Valloric/ycmd/commits/8b2f78acb4cc19a5ec4c9bbb8a60f97911d33d3c"}]}
{"actor":{"display_login":"homu"}}