question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

strange bug: first request after launching the browser is skipped - (pending) request

See original GitHub issue

Platform: Windows 10 Enterprise, build 19041 ; Python 3.8 ; Bottle v.0.12.19 Tested browsers: Chrome, Edge No internet connection on the computer

Run this app.py in a console:

from bottle import Bottle, TEMPLATE_PATH, template, static_file
app = Bottle("")
TEMPLATE_PATH.append("templates")
@app.route("/pages/<page>")
def page_route(page=None):
    return template(f"{page}.html")
app.run(port=5001)

templates/starting.html

hello
  • Then open Edge or Chrome, enter http://127.0.0.1:5001/pages/starting in the URL bar, then enter. Then the circular progress bar is turning, but the request isn’t done.
  • It is not logged in the Python/bottle console (which usually logs all requests)
  • The browser Developer Tools > Network tab shows Status (pending)
  • If I refresh the browser by selecting the URL bar and re-do ENTER, then it works, the request is done, and the browser shows “hello”.
  • Same problem if I launch the browser from command-line: chrome.exe --kiosk http://127.0.0.1:5001/pages/starting, sometimes it works, sometimes this page is not loaded on startup
  • This issue never happens when I use python -m http.server, so it might potentially be linked to bottle
  • I cannot reproduce the bug on another Windows 7 computer

Do you have any idea?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:27 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
j9browncommented, Aug 2, 2022

I am observing a similar issue with a “(pending)” request that doesn’t get logged and doesn’t complete until much later with a Bottle server running on Linux and recent Chrome on Mac OS.

tcpdump shows the HTTP request packet being sent by the browser to the Bottle server and ACK’d. However Bottle doesn’t seem to notice that it has a request pending: it does not log the request and it does not send any response.

Subsequently upon receiving another HTTP request, Bottle will finally notice that it already had one pending and it processes both requests immediately.

I suspect that there’s an issue in Bottle’s event loop that’s causing it to fail to notice that there’s data available to read on the socket.

In my tests, I can reproduce this very reliably by issuing POST requests from the browser by clicking on a button a few times. The requests will be processed normally several times, then one stalls.

0reactions
josephernestcommented, Aug 3, 2022

Bug report on Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1349353

Issue now 100% solved @defnull: I confirm it’s the Chrome Preload “feature”.

Solution:

As a work around, you can turn off the preconnection feature in chrome. Go to Settings > Advanced > Privacy and security and turn off Use a prediction service to load pages more quickly. This is now in Settings > Cookies and other site data > Preload pages for faster browsing and searching in more recent versions of Chrome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Update: Dec. 16] YouTube bugs/issues & pending ...
Here we are tracking all the bugs and problems found on YouTube and their status as well as any pending improvements that are...
Read more >
[Bug]: version 12.0.0 – Error: Unexpected extraInfo events for ...
Puppeteer will work fine if a responseReceivedExtraInfo comes before or after the corresponding responseReceived. Are you seeing any strange ...
Read more >
RFC 2616 8.2.2 being ignored during 413 Request Entity Too ...
Ideally (per RFC 2616 8.2.2) Chrome should be monitoring for that 413, and halt the transfer, and display the 413 error page. What...
Read more >
What does status=canceled for a resource mean in Chrome ...
The event successfully sends the request, but is is canceled then (but processed by the server). The reason is, the elements submit forms...
Read more >
chrome requests get stuck pending [closed] - Server Fault
Open the network debugger in Chrome and try to reproduce a stuck request. It will show you an exact timeline: when the request...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found