Repository navigation
test(tracing): close the second page before stopping the trace to avoid a slow tracingComplete - #657
Merged
Merged
Conversation
…id a slow tracingComplete Chrome delays Tracing.tracingComplete by several seconds while waiting for the renderer of a page opened mid-trace to flush, so under load the outer record exceeded the 5s timeout and returned nil.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the flaky
spec/page/tracing_spec.rb:43("raises an error when tracing is on two pages").The example opens a second page while tracing is running. On
Tracing.end, Chrome waits for that page's renderer to flush its trace buffers before sendingTracing.tracingComplete. Under load this took up to ~6.6s, longer than the default 5s timeout, sorecordreturnednilwithout writing the trace file and theFile.exist?check failed.The spec now closes the second page inside the
recordblock, before tracing stops. Under heavy CPU load the whole file failed 9 of 10 runs before the change and passes 15 of 15 after it; the slowest run is now ~1.4s.