SShortSingh.
Back to feed

Why Python Worker Processes Should Never Inherit Parent Logging Handlers

0
·46 views

Python's multiprocessing module can cause subtle but serious bugs when worker processes inherit logging handlers from the parent process. Under the fork start method, children copy the parent's RLock mid-emit, potentially deadlocking forever if the lock was held at fork time. Under spawn, children start with a fresh interpreter and never run the parent's logging setup, causing worker logs to silently disappear while the parent reports success. The same logging cleanup code can therefore produce two distinct failures — a deadlock on Linux and silent log loss on Windows or macOS — making cross-platform review unreliable. Developers are advised to treat logging handlers like file descriptors or open sockets: each process should configure its own handlers explicitly rather than relying on inherited state.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

AiRap.me turns a single photo into a lip-synced AI rap video

A developer built AiRap.me after finding that making an AI rap video required stitching together several separate tools. The platform lets users upload one photo, choose a style, and receive a finished rap video in roughly 20 to 30 seconds. The AI writes an original verse, produces the beat and vocals, and lip-syncs the face, and it supports people, pets, and cartoon or 3D characters across eight styles. Videos are delivered as watermark-free MP4s, and users are charged only when a video finishes, with free credits offered to new accounts. The developer is requesting community feedback on additional styles and the upload workflow.

0
ProgrammingDEV Community ·

Developer builds free macOS app Shoji to add a paper-like texture to screens

After reading a research paper late at night, a backend developer found that the bright, glossy look of a Mac display felt harsh during long reading sessions. Existing paper-texture apps either required payment before any trial or came bundled in larger subscriptions, which he felt was inappropriate for something users can only judge through extended use. He built Shoji, a free app named after Japanese shoji screens, which places a transparent, click-through overlay across every display to render a light paper texture. The textures are procedurally generated in code to avoid visible tiling, and they are tuned separately for light and dark modes. The project also covered technical details such as hiding the overlay from screen sharing and navigating macOS notarization.

0
ProgrammingDEV Community ·

Decoupling Frame Capture From Inference Cuts Edge Vision Latency in Python

The article addresses the problem that running object detection models such as YOLOv8 on every frame of an edge camera stream can overwhelm CPU or GPU resources. For slow-changing monitoring tasks like plant health or industrial gauges, processing each frame adds little diagnostic value. The author proposes a Python pipeline that separates frame capture from model execution using a bounded queue of size one, so the model always evaluates the latest frame and stale frames are discarded. The approach also includes a worker thread that paces inference to a target frame rate and a helper function for logging inference latency to monitor service health. The author argues that this design keeps resource usage predictable and enables local deployment without cloud round-trip delays.

0
ProgrammingDEV Community ·

How R6 Stat Trackers Calculate K/D and Win Rate, and Why Sites Can Differ

A developer breakdown explains how Rainbow Six Siege stat trackers compute core player figures such as K/D, headshot percentage and win rate. K/D is shown as the kill count when a player has zero deaths, which keeps the value sortable and avoids broken-looking displays. Win rate can use either a ranked-season denominator or a lifetime-matches denominator, which is a common reason two trackers report different numbers for the same account. The article also covers caching ranked data from an API with time windows tuned to each data type, and returning a dash rather than 0.0% when there is no sample. It uses the unofficial tracker SiegeRadar as its example, noting that the site is not affiliated with Ubisoft.