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.

KEEP_ALIVE_TIMEOUT causing the changes in server (mode debug) to be delayed?

See original GitHub issue

Describe the bug When running Sanic with the following options:

app.run(auto_reload=True, debug=True)

If I make any changes to my code and refresh, the new code is not taken into consideration. I need to wait a few seconds, and I’ll see the following message in the console:

[DEBUG] KeepAlive Timeout. Closing connection.

Reading the documentation, settings KEEP_ALIVE to False in dev mode would solve my issue, but it doesn’t change anything. The error still is displayed after about 8 seconds.

What can I do to have my new code refreshed immediately when running Sanic?

Expected behavior New code executed on refresh, not the previous one.

Environment (please complete the following information):

  • OS: Fedora 24
  • Version: 21.6.2
  • Python: 3.8.10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

2reactions
cnicodemecommented, Sep 30, 2021

I can provide a reproducible example, but probably not until Monday, so don’t be surprised if I don’t post anything until then 😃

0reactions
Troniccommented, Oct 6, 2021

Currently (with or without my changes) REQUEST_TIMEOUT is completely useless. It only affects someone typing in a request over netcat because normally all headers are received in a millisecond, and confusingly enough RESPONSE_TIMEOUT is the one that actually covers the request body. I might prefer a more simplified timeout system with the ability to implement advanced logic in a streaming handler or via a middleware, if needed (e.g. an app could reset the timer after every I/O if it wants). But obviously that is another topic and not something that I would look into right now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop annoying session keep alive message in ssh login
This will cause the client to keep the connection alive without ever triggering the server's keep-alive timeout.
Read more >
TCP Keepalive Best Practices - detecting network drops and ...
Analyze and resolve that problem to prevent the initial job failure. As a work-around, to detect network drops more quickly, and retry jobs ......
Read more >
MQTT Keep Alive Interval Explained With Examples
The keepalive is 6 seconds. The debug logging is set so that you see more detail on what is happening you can set...
Read more >
Avoiding the Top 10 NGINX Configuration Mistakes
To change the log directory, include the -e <error_log_location> ... Mistake 3: Not Enabling Keepalive Connections to Upstream Servers.
Read more >
HTTP persistent connection - Wikipedia
HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using a single TCP connection to send and...
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