{"action":"created","issue":{"url":"https://api.github.com/repos/netty/netty/issues/3537","labels_url":"https://api.github.com/repos/netty/netty/issues/3537/labels{/name}","comments_url":"https://api.github.com/repos/netty/netty/issues/3537/comments","events_url":"https://api.github.com/repos/netty/netty/issues/3537/events","html_url":"https://github.com/netty/netty/pull/3537","id":64407435,"number":3537,"title":"Avoid ConcurrentModificationException when iterating over Http2Connectio...","user":{"login":"buchgr","id":1388179,"avatar_url":"https://avatars.githubusercontent.com/u/1388179?v=3","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/netty/netty/labels/defect","name":"defect","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/netty/netty/milestones/112","html_url":"https://github.com/netty/netty/milestones/4.1.0.Beta5","labels_url":"https://api.github.com/repos/netty/netty/milestones/112/labels","id":1005380,"number":112,"title":"4.1.0.Beta5","description":"","creator":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars.githubusercontent.com/u/439362?v=3","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"open_issues":73,"closed_issues":17,"state":"open","created_at":"2015-03-04T09:22:23Z","updated_at":"2015-03-26T18:33:00Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-03-26T01:01:34Z","updated_at":"2015-03-26T18:33:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/3537","html_url":"https://github.com/netty/netty/pull/3537","diff_url":"https://github.com/netty/netty/pull/3537.diff","patch_url":"https://github.com/netty/netty/pull/3537.patch"},"body":"...n.activeStreams().\r\n\r\nMotivation:\r\n\r\nWe have seen `ConcurrentModificationExceptions` being thrown in `DefaultHttp2RemoteFlowController.writePendingBytes()`\r\nwhile iterating over all active streams and trying to flush their frames buffered in the flow controller.\r\n\r\nThe issue can be reproduced 100% of the time, when we receive a `WINDOW_UPDATE` for the connection and we\r\nsubsequently write a frame with the `END_STREAM` flag set of a stream that is already state `HALF_CLOSED_REMOTE`,\r\nthen the frame gets closed and removed from the set of active streams - thus a `ConcurrentModificationException`\r\nis raised.\r\n\r\nModifications:\r\n\r\n- Replace the `LinkedHashSet` with a `ConcurrentSkipListSet`, which allows for being modified while being iterated over.\r\n- Require `Http2Connection.activeStreams()` to return a collection that allows for concurrent modifications.\r\n\r\nResult:\r\n\r\nThe HTTP2 codec no longer crashes in the before mentioned scenario."},"comment":{"url":"https://api.github.com/repos/netty/netty/issues/comments/86660498","html_url":"https://github.com/netty/netty/pull/3537#issuecomment-86660498","issue_url":"https://api.github.com/repos/netty/netty/issues/3537","id":86660498,"user":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars.githubusercontent.com/u/439362?v=3","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T18:33:54Z","updated_at":"2015-03-26T18:33:54Z","body":"@buchgr I think it would be better to not use \"Concurrent*\" here but eliminate the cause of it as we are single threaded. Maybe just copy the collection before or just \"mark\" stuff as deleted and delete later ?"}}