-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple exchanges are created for the same request when network intercept is enabled #480
Comments
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 Lines 395 to 445 in 5ca5e9e
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Normally,
build_exchange
is called uponNetwork.requestWillBeSent
:ferrum/lib/ferrum/network.rb
Lines 387 to 388 in 5ca5e9e
When a
whitelist
is registered, aFetch.requestPaused
event is also registered and causesbuild_exchange
to be called again for the same request:ferrum/lib/ferrum/page.rb
Lines 367 to 368 in ac52ce9
As 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.
The text was updated successfully, but these errors were encountered: