{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/35267","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/35267/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/35267/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/35267/events","html_url":"https://github.com/dotnet/corefx/pull/35267","id":409452271,"node_id":"MDExOlB1bGxSZXF1ZXN0MjUyNDMzNzI0","number":35267,"title":"Schedule completion prior to pooling segments","user":{"login":"benaadams","id":1142958,"node_id":"MDQ6VXNlcjExNDI5NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1142958?v=4","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-02-12T19:01:21Z","updated_at":"2019-02-12T19:39:56Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/35267","html_url":"https://github.com/dotnet/corefx/pull/35267","diff_url":"https://github.com/dotnet/corefx/pull/35267.diff","patch_url":"https://github.com/dotnet/corefx/pull/35267.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/462904297","html_url":"https://github.com/dotnet/corefx/pull/35267#issuecomment-462904297","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/35267","id":462904297,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2MjkwNDI5Nw==","user":{"login":"benaadams","id":1142958,"node_id":"MDQ6VXNlcjExNDI5NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1142958?v=4","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"created_at":"2019-02-12T19:39:56Z","updated_at":"2019-02-12T19:39:56Z","author_association":"COLLABORATOR","body":"> Is that not a problem at scale?\r\n\r\nPool size is 16; segments are 4096 bytes so that would affect many small writes without Flush larger than 60kB (15 segments * 4096b) or larger if the ArrayPool is being used.\r\n\r\nIf you are doing single shot large writes then it would be 16 writes without a Flush (say 1MB x 16 = 16MB) that would hit this.\r\n\r\nOn the flip size holding the lock which is for both reader and writer and delaying the signaling of the continuation is more of an issue as `ResetMemory` is pretty chunky and needs to be called for every block returned; as well as then either returing the data via ArrayPool.Return (or ConcurrentQueue for Kestrel); so the writer wouldn't be able to make progress during this time (currently)\r\n\r\ne.g. (called for every block returned)\r\n```asm\r\n; Assembly listing for method BufferSegment:ResetMemory():this\r\n; Lcl frame size = 40\r\n\r\nG_M401_IG01:\r\n       57                   push     rdi\r\n       56                   push     rsi\r\n       4883EC28             sub      rsp, 40\r\n       488BF1               mov      rsi, rcx\r\n\r\nG_M404_IG02:\r\n       488B5628             mov      rdx, gword ptr [rsi+40]\r\n       48B9B8D075C9FA7F0000 mov      rcx, 0x7FFAC975D0B8\r\n       E8546A615F           call     CORINFO_HELP_ISINSTANCEOFINTERFACE\r\n       4885C0               test     rax, rax\r\n       7417                 je       SHORT G_M404_IG03\r\n       488BC8               mov      rcx, rax\r\n       49BB081536C9FA7F0000 mov      r11, 0x7FFAC9361508\r\n       3909                 cmp      dword ptr [rcx], ecx\r\n       FF1552B89AFF         call     [IDisposable:Dispose():this]\r\n       EB49                 jmp      SHORT G_M404_IG04\r\n\r\nG_M404_IG03:\r\n       488B5628             mov      rdx, gword ptr [rsi+40]\r\n       48B9020D50C9FA7F0000 mov      rcx, 0x7FFAC9500D02\r\n       E845274F5F           call     CORINFO_HELP_ISINSTANCEOFARRAY\r\n       488BF8               mov      rdi, rax\r\n       4885FF               test     rdi, rdi\r\n       742E                 je       SHORT G_M404_IG04\r\n       48B9003F45C9FA7F0000 mov      rcx, 0x7FFAC9453F00\r\n       BA77000000           mov      edx, 119\r\n       E8B96C5F5F           call     CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS\r\n       48B9E02E951095010000 mov      rcx, 0x19510952EE0\r\n       488B09               mov      rcx, gword ptr [rcx]\r\n       488BD7               mov      rdx, rdi\r\n       4533C0               xor      r8d, r8d\r\n       3909                 cmp      dword ptr [rcx], ecx\r\n       E89795FFFF           call     TlsOverPerCoreLockedStacksArrayPool`1:Return(ref,bool):this\r\n\r\nG_M405_IG04:\r\n       33C0                 xor      rax, rax\r\n       48894608             mov      gword ptr [rsi+8], rax\r\n       33C0                 xor      rax, rax\r\n       48894610             mov      qword ptr [rsi+16], rax\r\n       33C0                 xor      rax, rax\r\n       33D2                 xor      edx, edx\r\n       488D4E18             lea      rcx, bword ptr [rsi+24]\r\n       488901               mov      gword ptr [rcx], rax\r\n       895108               mov      dword ptr [rcx+8], edx\r\n       89510C               mov      dword ptr [rcx+12], edx\r\n       33C0                 xor      rax, rax\r\n       48894628             mov      gword ptr [rsi+40], rax\r\n       48894630             mov      gword ptr [rsi+48], rax\r\n       33C0                 xor      eax, eax\r\n       894638               mov      dword ptr [rsi+56], eax\r\n       33C0                 xor      rax, rax\r\n       33D2                 xor      edx, edx\r\n       4883C640             add      rsi, 64\r\n       488906               mov      gword ptr [rsi], rax\r\n       895608               mov      dword ptr [rsi+8], edx\r\n       89560C               mov      dword ptr [rsi+12], edx\r\n\r\nG_M407_IG05:\r\n       4883C428             add      rsp, 40\r\n       5E                   pop      rsi\r\n       5F                   pop      rdi\r\n       C3                   ret      \r\n\r\n; Total bytes of code 197, prolog size 6 for method BufferSegment:ResetMemory():this\r\n```"}}
{"actor":{"display_login":"benaadams"}}