Skip to content
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

Too many pending WebTransport sessions in Chromium #211

Open
Tracked by #255
lidel opened this issue Aug 24, 2023 · 5 comments
Open
Tracked by #255

Too many pending WebTransport sessions in Chromium #211

lidel opened this issue Aug 24, 2023 · 5 comments
Labels
env:browser kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@lidel
Copy link
Member

lidel commented Aug 24, 2023

Ref. https://bugs.chromium.org/p/chromium/issues/detail?id=1473980

What steps will reproduce the problem?

  1. Visit https://helia-identify.on.fleek.co/
  2. Open the console
  3. Wait a minute or two

What is the expected result?

  • No uncatchable WebTransport errors or warnings should appear in the console
  • 👉 We should be able to detect when we have too many pending WebTransport sessions and close them
  • 👉 We should be able to recover from this state and begin opening WebTransport sessions again

What happens instead?

A warning appears in the console: WebTransport session establishment failed. Too many pending WebTransport sessions (64)

All subsequent attempts to open a WebTransport session on any server fail with "WebTransportError: Connection lost"


Timeline

cc @achingbrain @SgtPooki

@lidel lidel added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization env:browser labels Aug 24, 2023
@lidel
Copy link
Member Author

lidel commented Aug 24, 2023

This is negatively impacting use of WebTransport libp2p transport (#190 (comment)) in Chromium browsers.

@javifernandez do you have thoughts on if problems marked with (:point_right: ) are something Chrome team will fix sooner than later, or if this is something that won't happen without an additional push? (not urgent, we can discuss during check-in on 14th Sep, just wanted cc you on this)

@SgtPooki
Copy link
Member

@javifernandez Any updates you can provide? pending & failed WebTransport sessions end up completely halting functionality for js-libp2p when enabled, which is unfortunate because WebTransport was supposed to open up a lot of opportunity for p2p in the browser.

@Faolain
Copy link

Faolain commented Jan 2, 2024

I believe we saw this back in April and @achingbrain gave us a solution for (tested in realtime and worked) which @eloramirez1356 will be sharing

@eloramirez1356
Copy link

eloramirez1356 commented Jan 4, 2024

The solution I tried and that was given back in April is the following one, and related to filter connections to reduce the number of useless connections:

const heliaNode = await createHelia({
                libp2p: {
                    connectionGater: {
                        filterMultiaddrForPeer: async (peer, multiaddrTest) => {
                            const multiaddrString = multiaddrTest.toString();
                            if (
                                multiaddrString.includes("/ip4/127.0.0.1") ||
                                multiaddrString.includes("/ip6/")
                            ) {
                                return false;
                            }
                            return true;
                        },
                        denyDialMultiaddr: async (multiaddrTest) => {
                            const multiaddrString = multiaddrTest.toString();
                            console.log("multiaddrString", multiaddrString);
                            if (
                                multiaddrString.includes("/ip4/127.0.0.1") ||
                                multiaddrString.includes("/ip6/")
                            ) {
                                return true;
                            }
                            return false;
                        },
                    },
                },
            });

This previous configuration reduces the speed of the increasing in the number of webtransport failed sessions, concretely without that configuration (using default libp2p configuration by "await createHelia()") it shows 500 or 600 failed sessions right after loading the page and with the previous configuration around 200 or 300, but still getting the issue of connection lost.

I will let you know in case I was able to handle this and fix the issue.

In case it was useful too, I am having the following error in case it was related to this warning too:

stream.js:152 Uncaught (in promise) DOMException: The stream was aborted by the remote server

Thanks!

@javifernandez
Copy link

@javifernandez Any updates you can provide? pending & failed WebTransport sessions end up completely halting functionality for js-libp2p when enabled, which is unfortunate because WebTransport was supposed to open up a lot of opportunity for p2p in the browser.

Sorry about the delay, but I've been busy with other tasks; this is now in the top of my tasks list and I have started already with the preliminary analysis of the use case, the demos and the discussion in the Chromium bug. I have to say that although the information in the bug is very useful to understand the root cause of the problem and the use case libp2p is trying to address, there are some open questions that we need to clarify before I can figure out the best approach.

Basically, the penalty for failed connections is by design (although I agree it's not part of the Web Transport specification). Google admitted that Chrome could be smart on some cases (eg, lower penalty for failures in different IPs). The Throtting based on the server IP is something already considered in the design doc, although discarded due to it's potential complexity.

If I've understood it correctly, an smarter throttilng is not the ideal solution, although it'd help; since failed handskaeks are being treated as pending for a long period of time (due to the penalty), we would need a way to cancel them so that the app recovers from this state and can open new sessions again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env:browser kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

5 participants