this post was submitted on 29 Jun 2023
28 points (93.8% liked)

Python

6471 readers
9 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] o11c 5 points 2 years ago* (last edited 2 years ago) (1 children)

It's worth noting that the http.server module is based on socketserver.BaseServer.serve_forever, which is a atrocious.

It uses a busy loop with a delay, so it both burns CPU and is unresponsive.

(The fact that Python has had broken signal handling since 3.5 also hurts - EINTR should never be ignored from blocking calls)

[–] jim 2 points 2 years ago (1 children)

I was just about to uninstall nginx...

On a serious note: I'm not sure of the details of socketserver but I would think opening a socket would not be a cpu intensive process.

[–] o11c 1 points 2 years ago

The comments in the code explain exactly what the problem is and how to fix it, and it would take less than 30 minutes to implement and test that (assuming you don't just grab someone else's version - there's a reason I know the time), but nobody has committed it in ... at least 13 years since the comment was written; I'm not digging any further through imported SVN history.