Open rzane opened 3 months ago
I managed to make a script that occasionally reproduces the issue.
https://gist.github.com/rzane/a4efe24db7ce44491f0ec6056ac16401
Note: The reason these pending requests aren't marked as #finished?
is because the subscriptions that handle responses only assign properties to select(request_id).last
Describe the bug
Normally,
build_exchange
is called uponNetwork.requestWillBeSent
: https://github.com/rubycdp/ferrum/blob/5ca5e9ed5e9ac8be580589e234aadc1de6929bc0/lib/ferrum/network.rb#L387-L388When a
whitelist
is registered, aFetch.requestPaused
event is also registered and causesbuild_exchange
to be called again for the same request: https://github.com/rubycdp/ferrum/blob/ac52ce960c681b1fa0bb9d448fc3d6a7e761f3a9/lib/ferrum/page.rb#L367-L368As a result,
Network#traffic
will have two exchanges referencing the same request. One of these exchanges will not be#finished?
. As a result, callingwait_for_idle
will raiseFerrum::TimeoutError
.To Reproduce I'm not sure if I'll be able to produce a minimal reproduction. This happens pretty infrequently.
I added some logging to
network.rb
and here's what I found in my application:In the logs above,
94044.261
is the request ID.19883500
and19883520
areExchange#object_id
. As you can see, two exchanges were created for this request.Expected behavior
Changing this line appears to fix the issue:
That being said, I'm sure there's a good reason why this
.blank?
check exists.Screenshots None
Desktop (please complete the following information):
Additional context None.