)]}'
{"glance/common/wsgi.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"5ee32bbdf84917eca4964fbfe687571a16cb1a17","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        self.logger \u003d logging.getLogger(\u0027glance.wsgi.server\u0027)"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"        workers \u003d (getattr(CONF, \u0027workers\u0027, None) or"},{"line_number":242,"context_line":"                   processutils.get_worker_count())"},{"line_number":243,"context_line":"        if workers \u003d\u003d 0:"},{"line_number":244,"context_line":"            # Useful for profiling, test, debug etc."},{"line_number":245,"context_line":"            self.pool \u003d self.create_pool()"}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_9b11a255","line":242,"updated":"2014-06-26 20:05:53.000000000","message":"workers \u003d getattr(CONF, \u0027workers\u0027, processutils.get_worker_count())","commit_id":"e685053e5ec43dc93e7fe2a179891d89c9bab6bf"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"956e89ad26f05aaee1027979def7f170716e4f98","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        self.logger \u003d logging.getLogger(\u0027glance.wsgi.server\u0027)"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"        workers \u003d (getattr(CONF, \u0027workers\u0027, None) or"},{"line_number":242,"context_line":"                   processutils.get_worker_count())"},{"line_number":243,"context_line":"        if workers \u003d\u003d 0:"},{"line_number":244,"context_line":"            # Useful for profiling, test, debug etc."},{"line_number":245,"context_line":"            self.pool \u003d self.create_pool()"}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_e9e009ce","line":242,"in_reply_to":"1ae5cdf2_915c234e","updated":"2014-06-27 13:17:58.000000000","message":"Actually this approach could resolve hang issue of functional test as well, since \u0027workers  \u003d 0 or N\u0027 code will always sets the value of \u0027workers\u0027 var to N, so single-run logic of wsgi app by greenthread for functional test/debug will never be triggered (line #244-247).\n\nIMO, the root cause of hang issue is that the code [0] and [1] could trigger a direct forking logic, under testr context (for example [2]), this code will ask wsgi.Server spawn out a/some \u0027testr\u0027 process(es) by forking (line #296), then when all test cases get finish and \u0027main\u0027 real testr process exit, you can see other forked \u0027testr\u0027 processes will still there (for example [3], see those parent pid - from \u002721914\u0027 to \u00271\u0027), so actually the hang doesn\u0027t happen for those test cases but those \u0027testr\u0027 processes (you can just kill those \u0027testr\u0027 processes, and the successful test result will be shown out). I checked those \u0027testr\u0027 processes (by \u0027lsof -p 24292 | grep LISTEN\u0027 and \u0027netstat\u0027, for example), I\u0027m sure those \u0027testr\u0027 are running on listen mode as a wsgi server as line #336 required.\n\nAs verification, I also tried to remove lockutil out from code base and the hang issue still there, but anyway I still like to see we update lockutil for this change.\n\nBtw, I think glance.tests.functional.Server base class has not this problem (even with this wrong code logic, as I tested locally I can see ncpu glance-* processes was launched there during one functional test case running even you set \u0027workers\u003d0\u0027 for ApiServer and RegistryServer), since it used execvpe() syscall [4] to reloaded whole glance.cmd.* code into forked testr process as replacement, so it\u0027s different then [0][1] cases.\n\n\n[0] https://github.com/openstack/glance/blob/master/glance/tests/functional/test_client_exceptions.py#L76\n\n[1] https://github.com/openstack/glance/blob/master/glance/tests/functional/test_client_redirects.py#L91\n\n[2] http://paste.openstack.org/show/85062/\n\n[3] http://paste.openstack.org/show/85064/\n\n[4] https://github.com/openstack/glance/blob/master/glance/tests/utils.py#L200\n\nThoughts?","commit_id":"e685053e5ec43dc93e7fe2a179891d89c9bab6bf"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6fc089305f6ec08ccc12da47fd99d696e26c9628","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        self.logger \u003d logging.getLogger(\u0027glance.wsgi.server\u0027)"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"        workers \u003d (getattr(CONF, \u0027workers\u0027, None) or"},{"line_number":242,"context_line":"                   processutils.get_worker_count())"},{"line_number":243,"context_line":"        if workers \u003d\u003d 0:"},{"line_number":244,"context_line":"            # Useful for profiling, test, debug etc."},{"line_number":245,"context_line":"            self.pool \u003d self.create_pool()"}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_915c234e","line":242,"in_reply_to":"1ae5cdf2_9b11a255","updated":"2014-06-26 21:35:21.000000000","message":"Good point, will do.","commit_id":"e685053e5ec43dc93e7fe2a179891d89c9bab6bf"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0b5cd5a842e14200d1066d0e3d61c0347b0aa848","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        self.logger \u003d logging.getLogger(\u0027glance.wsgi.server\u0027)"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"        workers \u003d (getattr(CONF, \u0027workers\u0027, None) or"},{"line_number":242,"context_line":"                   processutils.get_worker_count())"},{"line_number":243,"context_line":"        if workers \u003d\u003d 0:"},{"line_number":244,"context_line":"            # Useful for profiling, test, debug etc."},{"line_number":245,"context_line":"            self.pool \u003d self.create_pool()"}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_376ec8c8","line":242,"in_reply_to":"1ae5cdf2_e9e009ce","updated":"2014-06-27 13:25:17.000000000","message":"Wow, thank you very much for the detailed analysis - with a clear head (and lots of coffee) it\u0027s obvious now that the logic in determining the value is wrong if we ever want to use workers\u003d0, which is what the functional tests are doing, since (0 or (\u003e0)) will take the \u003e0 value, which is why the functional tests changed behavior when I didn\u0027t expect them to.\n\nI\u0027ll get this updated this morning.","commit_id":"e685053e5ec43dc93e7fe2a179891d89c9bab6bf"}]}
