{"action":"opened","issue":{"url":"https://api.github.com/repos/whatwg/streams/issues/413","labels_url":"https://api.github.com/repos/whatwg/streams/issues/413/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/streams/issues/413/comments","events_url":"https://api.github.com/repos/whatwg/streams/issues/413/events","html_url":"https://github.com/whatwg/streams/issues/413","id":121549939,"number":413,"title":"cancel.js test can be flaky","user":{"login":"calvaris","id":1021526,"avatar_url":"https://avatars.githubusercontent.com/u/1021526?v=3","gravatar_id":"","url":"https://api.github.com/users/calvaris","html_url":"https://github.com/calvaris","followers_url":"https://api.github.com/users/calvaris/followers","following_url":"https://api.github.com/users/calvaris/following{/other_user}","gists_url":"https://api.github.com/users/calvaris/gists{/gist_id}","starred_url":"https://api.github.com/users/calvaris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvaris/subscriptions","organizations_url":"https://api.github.com/users/calvaris/orgs","repos_url":"https://api.github.com/users/calvaris/repos","events_url":"https://api.github.com/users/calvaris/events{/privacy}","received_events_url":"https://api.github.com/users/calvaris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-10T18:35:49Z","updated_at":"2015-12-10T18:35:49Z","closed_at":null,"body":"ReadableStream cancellation: integration test on an infinite stream derived from a random push source can be very flaky.\r\n\r\n1. So the test begins with the creation of the RS and readableStreamToArray begins to pump.\r\n2. After 15ms + day promise vending, reader.cancel is called\r\n3. As a result of reader.cancel, the pending read is vended with done, which returns the chunks and creates the cascade of vending the read promises. I don't know how much async this is.\r\n4. Then the source cancel is called. This creates a promise that sets the timeout to set cancellationFinished to true and vend the promise. Promise is returned.\r\n\r\nThe issue is that between the cascade of reads of point 3 in some cases I see the cancel promise timeout sneaking in and setting cancellationFinished to true so the assert_false inside the readableStreamToArray.\r\n\r\nI know that promise vending should happen within the microtask loop, unlike timeouts, so I am not sure about this, but there's still a cascade of 6 reads to be solved (I manage to get 5 reads completed before the cancel plus the pending one) while we get the source cancel running and setting the timeout, that in significant amount of cases gets executed."}}