{"action":"created","issue":{"url":"https://api.github.com/repos/locustio/locust/issues/299","labels_url":"https://api.github.com/repos/locustio/locust/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/locustio/locust/issues/299/comments","events_url":"https://api.github.com/repos/locustio/locust/issues/299/events","html_url":"https://github.com/locustio/locust/issues/299","id":90736862,"number":299,"title":"Inconsistent stats resetting","user":{"login":"devoto13","id":823594,"avatar_url":"https://avatars.githubusercontent.com/u/823594?v=3","gravatar_id":"","url":"https://api.github.com/users/devoto13","html_url":"https://github.com/devoto13","followers_url":"https://api.github.com/users/devoto13/followers","following_url":"https://api.github.com/users/devoto13/following{/other_user}","gists_url":"https://api.github.com/users/devoto13/gists{/gist_id}","starred_url":"https://api.github.com/users/devoto13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devoto13/subscriptions","organizations_url":"https://api.github.com/users/devoto13/orgs","repos_url":"https://api.github.com/users/devoto13/repos","events_url":"https://api.github.com/users/devoto13/events{/privacy}","received_events_url":"https://api.github.com/users/devoto13/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-24T17:20:11Z","updated_at":"2015-07-18T02:14:02Z","closed_at":null,"body":"If I have requests inside `on_start()` method of my main task set, stats will be reseted before all requests are completed. As a result I get **some** of the initialization requests inside report and they clutter the data.\r\n\r\nRelevant code: [hatch()](https://github.com/locustio/locust/blob/master/locust/runners.py#L101-L119).\r\nI'm not closely familiar with gevent/greenlets, but issue seems to be related to greenlets nature. When request is sent from `on_start()` method it switches context back to `hatch()` and since all locusts are already hatched it emits `hatch_complete` event (but requests from `on_start()` are still running).\r\n\r\nAs a solution I see some kind of synchronization to let runner know, that locust initialization is done. Any ideas how to deal with this?"},"comment":{"url":"https://api.github.com/repos/locustio/locust/issues/comments/122469213","html_url":"https://github.com/locustio/locust/issues/299#issuecomment-122469213","issue_url":"https://api.github.com/repos/locustio/locust/issues/299","id":122469213,"user":{"login":"billibala","id":546385,"avatar_url":"https://avatars.githubusercontent.com/u/546385?v=3","gravatar_id":"","url":"https://api.github.com/users/billibala","html_url":"https://github.com/billibala","followers_url":"https://api.github.com/users/billibala/followers","following_url":"https://api.github.com/users/billibala/following{/other_user}","gists_url":"https://api.github.com/users/billibala/gists{/gist_id}","starred_url":"https://api.github.com/users/billibala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billibala/subscriptions","organizations_url":"https://api.github.com/users/billibala/orgs","repos_url":"https://api.github.com/users/billibala/repos","events_url":"https://api.github.com/users/billibala/events{/privacy}","received_events_url":"https://api.github.com/users/billibala/received_events","type":"User","site_admin":false},"created_at":"2015-07-18T02:14:02Z","updated_at":"2015-07-18T02:14:02Z","body":"I run into similar issue as well. The # requests counter reset. In my case, I haven't override on_start() at all."}}