payload: {"action":"created","issue":{"url":"https://api.github.com/repos/vmagamedov/grpclib/issues/78","repository_url":"https://api.github.com/repos/vmagamedov/grpclib","labels_url":"https://api.github.com/repos/vmagamedov/grpclib/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/vmagamedov/grpclib/issues/78/comments","events_url":"https://api.github.com/repos/vmagamedov/grpclib/issues/78/events","html_url":"https://github.com/vmagamedov/grpclib/issues/78","id":455770990,"node_id":"MDU6SXNzdWU0NTU3NzA5OTA=","number":78,"title":"Potential Race between EventsProcessor.close and EventsProcessor.register.release_stream","user":{"login":"lawrencelomax","id":217883,"node_id":"MDQ6VXNlcjIxNzg4Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/217883?v=4","gravatar_id":"","url":"https://api.github.com/users/lawrencelomax","html_url":"https://github.com/lawrencelomax","followers_url":"https://api.github.com/users/lawrencelomax/followers","following_url":"https://api.github.com/users/lawrencelomax/following{/other_user}","gists_url":"https://api.github.com/users/lawrencelomax/gists{/gist_id}","starred_url":"https://api.github.com/users/lawrencelomax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lawrencelomax/subscriptions","organizations_url":"https://api.github.com/users/lawrencelomax/orgs","repos_url":"https://api.github.com/users/lawrencelomax/repos","events_url":"https://api.github.com/users/lawrencelomax/events{/privacy}","received_events_url":"https://api.github.com/users/lawrencelomax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2019-06-13T14:21:22Z","updated_at":"2019-07-05T14:26:17Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nFirstly thanks for the awesome library. Having a pure-python implementation of grpc is very [important for us](https://github.com/facebook/idb)!\r\n\r\nWe've been seeing a level of \"Connection was closed\" errors and believe that we've isolated this to some internal races in the `EventsProcessor` code. Since we were pretty sure that the server was well-formed, we executed an identical request with the `grpcio` library and found that we couldn't reproduce this behaviour.\r\n\r\nIn here I can see [that there is a streams](https://github.com/vmagamedov/grpclib/blob/master/grpclib/protocol.py#L459) dictionary on `EventsProcessor`. This dictionary [is added to in](https://github.com/vmagamedov/grpclib/blob/master/grpclib/protocol.py#L469) `EventsProcessor.register` and de-registered in a [callback that this method returns](https://github.com/vmagamedov/grpclib/blob/master/grpclib/protocol.py#L473).\r\n\r\nIf there are any active streams at the time that `EventsProcessor.close` is called, [each of the current streams will be marked with \"Connection was closed\"](https://github.com/vmagamedov/grpclib/blob/master/grpclib/protocol.py#L483). When profiling this, we noticed that the ordering of `EventsProcessor.close` and `release_stream` could vary. If `close` was called before `release_stream`, we'd see this error propagate.\r\n\r\nNot too sure of much of the internals here, but I assume that the reason this exists is that:\r\n- There can be many streams per connection.\r\n- If any streams are \"active\" when a connection has closed, that should be reported as a fault with the underlying TCP transport.\r\n- When a stream is \"ended\" it will be removed from the set of active streams and will therefore not error out when a connection is closed\r\n- There may be some variance in timing between the delivery of each of these events.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/vmagamedov/grpclib/issues/comments/508775750","html_url":"https://github.com/vmagamedov/grpclib/issues/78#issuecomment-508775750","issue_url":"https://api.github.com/repos/vmagamedov/grpclib/issues/78","id":508775750,"node_id":"MDEyOklzc3VlQ29tbWVudDUwODc3NTc1MA==","user":{"login":"vmagamedov","id":179213,"node_id":"MDQ6VXNlcjE3OTIxMw==","avatar_url":"https://avatars3.githubusercontent.com/u/179213?v=4","gravatar_id":"","url":"https://api.github.com/users/vmagamedov","html_url":"https://github.com/vmagamedov","followers_url":"https://api.github.com/users/vmagamedov/followers","following_url":"https://api.github.com/users/vmagamedov/following{/other_user}","gists_url":"https://api.github.com/users/vmagamedov/gists{/gist_id}","starred_url":"https://api.github.com/users/vmagamedov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmagamedov/subscriptions","organizations_url":"https://api.github.com/users/vmagamedov/orgs","repos_url":"https://api.github.com/users/vmagamedov/repos","events_url":"https://api.github.com/users/vmagamedov/events{/privacy}","received_events_url":"https://api.github.com/users/vmagamedov/received_events","type":"User","site_admin":false},"created_at":"2019-07-05T14:26:17Z","updated_at":"2019-07-05T14:26:17Z","author_association":"OWNER","body":"I'm going to issue new release candidate very soon. Normally it is safe to use master, it is stable, but there is a possibility of backward-incompatible changes."}}
other: {"actor":{"display_login":"vmagamedov"}}