Skip to content

test(tracing): close the second page before stopping the trace to avoid a slow tracingComplete - #657

Merged
route merged 1 commit into
mainfrom
fix/flaky-tracing-spec
Oct 18, 2026
Merged

route merged 1 commit into
mainfrom
fix/flaky-tracing-spec

Conversation

@route

@route route commented Oct 18, 2026

Copy link
Copy Markdown
Member

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 sending Tracing.tracingComplete. Under load this took up to ~6.6s, longer than the default 5s timeout, so record returned nil without writing the trace file and the File.exist? check failed.

The spec now closes the second page inside the record block, 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.

…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.
@route
route merged commit ece8101 into main Oct 18, 2026
7 checks passed
@route
route deleted the fix/flaky-tracing-spec branch October 18, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant