René's URL Explorer Experiment


Title: [Bug]: StackOverflowError when a page makes thousands of requests under a route · Issue #2068 · microsoft/playwright-java · GitHub

Open Graph Title: [Bug]: StackOverflowError when a page makes thousands of requests under a route · Issue #2068 · microsoft/playwright-java

X Title: [Bug]: StackOverflowError when a page makes thousands of requests under a route · Issue #2068 · microsoft/playwright-java

Description: Version 1.65.1 (also 1.64.0) Steps to reproduce Save the file below as RouteBurst.java and run it with the Playwright jars on the classpath: java -cp "" RouteBurst.java 3000 import com.microsoft.playwright.*;...

Open Graph Description: Version 1.65.1 (also 1.64.0) Steps to reproduce Save the file below as RouteBurst.java and run it with the Playwright jars on the classpath: java -cp "" RouteBurst.java...

X Description: Version 1.65.1 (also 1.64.0) Steps to reproduce Save the file below as RouteBurst.java and run it with the Playwright jars on the classpath: java -cp "<playwright 1.65.1 classpath>"...

Opengraph URL: https://github.com/microsoft/playwright-java/issues/2068

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: StackOverflowError when a page makes thousands of requests under a route","articleBody":"### Version\n\n1.65.1 (also 1.64.0)\n\n### Steps to reproduce\n\nSave the file below as `RouteBurst.java` and run it with the Playwright jars on the classpath:\n\n```\njava -cp \"\u003cplaywright 1.65.1 classpath>\" RouteBurst.java 3000\n```\n\n```java\nimport com.microsoft.playwright.*;\nimport com.sun.net.httpserver.HttpServer;\nimport java.net.InetSocketAddress;\nimport java.nio.charset.StandardCharsets;\nimport java.util.concurrent.Executors;\n\npublic class RouteBurst {\n  public static void main(String[] args) throws Exception {\n    int n = args.length > 0 ? Integer.parseInt(args[0]) : 3000;\n    boolean routed = args.length \u003c 2 || !\"noroute\".equals(args[1]);\n    HttpServer server = HttpServer.create(new InetSocketAddress(\"127.0.0.1\", 0), 0);\n    server.createContext(\"/r\", ex -> {\n      byte[] body = \"ok\".getBytes(StandardCharsets.UTF_8);\n      ex.sendResponseHeaders(200, body.length);\n      ex.getResponseBody().write(body);\n      ex.close();\n    });\n    server.createContext(\"/\", ex -> {\n      String html = \"\u003cscript>window.done = false;\"\n        + \"Promise.allSettled(Array.from({length: \" + n + \"}, (_, i) => fetch('/r?i=' + i)))\"\n        + \".then(() => { window.done = true; });\u003c/script>\";\n      byte[] body = html.getBytes(StandardCharsets.UTF_8);\n      ex.getResponseHeaders().add(\"Content-Type\", \"text/html\");\n      ex.sendResponseHeaders(200, body.length);\n      ex.getResponseBody().write(body);\n      ex.close();\n    });\n    server.setExecutor(Executors.newFixedThreadPool(16));\n    server.start();\n    int[] handled = {0};\n    try (Playwright playwright = Playwright.create()) {\n      Browser browser = playwright.chromium().launch();\n      Page page = browser.newPage();\n      if (routed) {\n        page.route(\"**/*\", route -> { handled[0]++; route.resume(); });\n      }\n      page.navigate(\"http://localhost:\" + server.getAddress().getPort() + \"/\");\n      page.waitForFunction(\"window.done === true\");\n      System.out.println(\"OK requests=\" + n + \" handled=\" + handled[0]);\n    } catch (StackOverflowError e) {\n      System.out.println(\"StackOverflowError requests=\" + n + \" handled=\" + handled[0]);\n    } finally {\n      server.stop(0);\n    }\n    System.exit(0);\n  }\n}\n```\n\nThe page makes 3000 `fetch` calls. One `page.route(\"**/*\", ...)` handler resumes each request.\n\n### Expected behavior\n\n`OK requests=3000 handled=3001`, as for 1000 requests.\n\n### Actual behavior\n\n```\nStackOverflowError requests=3000 handled=1554\n```\n\n5 of 5 runs fail, each after about 1550 handled routes. Without the route (`RouteBurst.java 3000 noroute`) the run passes. The same occurs with `browserContext.route`.\n\nWith a pool of 100 workers in the page in place of one burst, the failure is intermittent (2 of 6 runs at 5000 to 10000 requests), because the depth depends on how many route events are in the queue.\n\n### Cause\n\nAfter each handled route, `PageImpl.handleEvent` and `BrowserContextImpl.handleRoute` call `updateInterceptionPatterns()`. That call sends `setNetworkInterceptionPatterns` and blocks until the answer arrives. While it blocks, `runUntil` dispatches the next message, which is the next `route` event. So each queued route event runs one level deeper on the same stack. A stack trace from inside the handler (1.65.1) shows the cycle:\n\n```\nuser handler\ncom.microsoft.playwright.impl.Router$RouteInfo.handle(Router.java:48)\ncom.microsoft.playwright.impl.Router.handle(Router.java:86)\ncom.microsoft.playwright.impl.PageImpl.handleEvent(PageImpl.java:226)\ncom.microsoft.playwright.impl.Connection.dispatch(Connection.java:347)\ncom.microsoft.playwright.impl.Connection.processOneMessage(Connection.java:261)\ncom.microsoft.playwright.impl.ChannelOwner.runUntil(ChannelOwner.java:154)\ncom.microsoft.playwright.impl.Connection.sendMessage(Connection.java:157)\ncom.microsoft.playwright.impl.ChannelOwner.sendMessage(ChannelOwner.java:142)\ncom.microsoft.playwright.impl.PageImpl.updateInterceptionPatterns(PageImpl.java:1438)\ncom.microsoft.playwright.impl.PageImpl.handleEvent(PageImpl.java:229)\ncom.microsoft.playwright.impl.Connection.dispatch(Connection.java:347)\ncom.microsoft.playwright.impl.Connection.processOneMessage(Connection.java:261)\n... the same 7 frames again for each queued route event\n```\n\nThis is the defect class of #678, where `Route.resume` and `Route.abort` stopped waiting for the answer. The pattern update after each route still waits.\n\nThe Node.js client does this differently in `Page._onRoute`: it updates the patterns only when no route remains, and it does not wait for the answer:\n\n```ts\nif (!this._routes.length)\n  this._updateInterceptionPatterns({ internal: true }).catch(() => {});\n```\n\nA possible fix is the same condition in Java (send the update only when the set of patterns changed, for example when a handler with `times` expired), or a send that does not wait.\n\nA second effect makes it worse: when `PLAYWRIGHT_JAVA_SRC` is set, each API call captures a stack trace, and the cost of that grows with the nesting depth. Then the client falls further behind and the nesting grows faster.\n\n### Additional context\n\nFound through https://github.com/Blockether/spel/issues/135, where a daemon with one catch-all route failed on pages with many requests. A workaround for a client is a route pattern that matches fewer requests, or a thread with a larger stack.\n\n### Environment\n\n- Operating System: macOS 27.2.1 (arm64)\n- JDK: OpenJDK 25.0.3\n- Browser: Chromium (bundled with 1.65.1), headless\n","author":{"url":"https://github.com/kwojcik-blockether","@type":"Person","name":"kwojcik-blockether"},"datePublished":"2026-11-21T23:26:03Z","url":"https://github.com/microsoft/playwright-java/issues/2068"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6285fab9-3506-6afa-6dc3-a41f8e67a827
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA834:560C3:3CE284:539234:6B04BFB6
html-safe-nonce222b4373244daf27de7df4c00f80a84c450c31124cc941bb5e0f892b2dfb73c7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODM0OjU2MEMzOjNDRTI4NDo1MzkyMzQ6NkIwNEJGQjYiLCJ2aXNpdG9yX2lkIjoiNTkzMTQxMDMxOTMwMDkzNTYwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac8a07b085cc10685d738204fb9ea39001d99c33bad596fc1697e6095876ff683c
hovercard-subject-tagissue:6535760317
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/playwright-java/2068/issue_layout
twitter:imagehttps://opengraph.githubassets.com/cc1b063a8c76e4a382ca14580a28a583ce4697398f571aeb1eb6cf903963093f/microsoft/playwright-java/issues/2068
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/cc1b063a8c76e4a382ca14580a28a583ce4697398f571aeb1eb6cf903963093f/microsoft/playwright-java/issues/2068
og:image:altVersion 1.65.1 (also 1.64.0) Steps to reproduce Save the file below as RouteBurst.java and run it with the Playwright jars on the classpath: java -cp "" RouteBurst.java...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekwojcik-blockether
hostnamegithub.com
expected-hostnamegithub.com
None85dd75377eb77313206b8fc108bcee6a3a029286d94bf32bf9b4426e4d92e0c4
turbo-cache-controlno-preview
go-importgithub.com/microsoft/playwright-java git https://github.com/microsoft/playwright-java.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id298640027
octolytics-dimension-repository_nwomicrosoft/playwright-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id298640027
octolytics-dimension-repository_network_root_nwomicrosoft/playwright-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release0d64fa748a2bab9a5b587a967ac4da1cfa8da6dd
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/playwright-java/issues/2068#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fplaywright-java%2Fissues%2F2068
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fplaywright-java%2Fissues%2F2068
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2Fplaywright-java
Reloadhttps://github.com/microsoft/playwright-java/issues/2068
Reloadhttps://github.com/microsoft/playwright-java/issues/2068
Reloadhttps://github.com/microsoft/playwright-java/issues/2068
microsofthttps://github.com/microsoft
playwright-javahttps://github.com/microsoft/playwright-java
Codehttps://github.com/microsoft/playwright-java
Issues3 (3)https://github.com/microsoft/playwright-java/issues
Pull requests1 (1)https://github.com/microsoft/playwright-java/pulls
Actionshttps://github.com/microsoft/playwright-java/actions
Security and qualityhttps://github.com/microsoft/playwright-java/security
Insightshttps://github.com/microsoft/playwright-java/insights
https://github.com/microsoft/playwright-java
New issuehttps://github.com/login?return_to=https://github.com/microsoft/playwright-java/issues/2068
New issuehttps://github.com/login?return_to=https://github.com/microsoft/playwright-java/issues/2068
[Bug]: StackOverflowError when a page makes thousands of requests under a routehttps://github.com/microsoft/playwright-java/issues/2068#top
agent-triagehttps://github.com/microsoft/playwright-java/issues?q=state%3Aopen%20label%3A%22agent-triage%22
https://github.com/kwojcik-blockether
Karol Wójcik (kwojcik-blockether)https://github.com/kwojcik-blockether
on Nov 21, 2026https://github.com/microsoft/playwright-java/issues/2068#issue-6535760317
#678https://github.com/microsoft/playwright-java/issues/678
Blockether/spel#135https://github.com/Blockether/spel/issues/135
Dmitry Gozman (dgozman)https://github.com/dgozman
agent-triagehttps://github.com/microsoft/playwright-java/issues?q=state%3Aopen%20label%3A%22agent-triage%22
on Nov 23, 2026https://github.com/microsoft/playwright-java/issues/2068#event-36996928340
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/playwright-java/issues/2068
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/playwright-java/issues/2068
agent-triagehttps://github.com/microsoft/playwright-java/issues?q=state%3Aopen%20label%3A%22agent-triage%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.