frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Python Concurrency Testing with Frontrun

https://github.com/lucaswiman/frontrun
1•lucaswiman•56m ago
Hi HN, I'm the author of Frontrun, a Python concurrency testing library I built over the past 6 months using Claude Code and Codex. It uses bytecode tracing and various forms of monkeypatching to schedule across threads, async and multiprocessing allowing you to find and deterministically reproduce race conditions or deadlocks.

It can understand Python variable assignments, SQL statements and Redis commands, which can detect races that cross abstraction boundaries, e.g. a deadlock between threading.Lock() in one thread and a SQL row lock in another.

To use it, do `pip install frontrun`[1] then put the following in a pytest case:

  result = frontrun.explore(
      setup=Counter,
      workers=Counter.increment,
      count=2,
  )
  result.assert_holds()
Then use `frontrun pytest path/to/test_counter.py`.

My hope is that this will allow authors of libraries which are not currently threadsafe to weather the freethreading transition more easily or to raise the bar for issue submissions involving race conditions. I've put a lot of work into making races deterministic and making the error trace interpretable, demonstrating why that sequence of events that triggers the race. I'd love any usability feedback or success/failure stories you have, and I'm happy to answer any questions about how it works.

[1] MacOS and Linux only.

Comments

lucaswiman•42m ago
A bit more about how it works internally. It uses sys.monitoring (or sys.set_trace for older versions of python), as well as LD_PRELOAD / DYNLIB libc patching to track arbitrary io events. It also monkeypatches basic concurrency primitives like the contents of `threading`. (Given how heavily monkeypatched that all is, I've been running frontrun tests separately from an ordinary test suite. The bundled binary handles all that when used with Pytest.)

It tracks "conflicts" at mutable boundaries, building: 1. A "shadow stack" recording when values are assigned to objects which are referenced from more than one thread. 2. A finer-grained model of SQL and Redis items that take into account some of the semantics of their concurrency models.

The code executes normally once, to get conflict points, then it uses a version of an algorithm called Dynamic Partial Order Reduction (DPOR) to efficiently search through all non-isomorphic traces looking for failures (either a crash, a statically detected deadlock, or a violation of the property/invariant provided in the test). This was partially inspired by the rust concurrency testing library Loom, though uses monkey-patching instead of customer concurrency primitives.

Microsoft is serious about fixing Windows, and it's doing things right this time

https://www.windowscentral.com/microsoft/windows-11/i-tested-5-major-changes-and-improvements-com...
1•thunderbong•6m ago•0 comments

LinuxViz – 3D Linux Kernel Architecture Explorer

https://tomasantunes.github.io/LinuxViz/
4•tomasantunes89•22m ago•1 comments

Black lung rates in Appalachia are high as the 1970s, thousands of miners sick

https://www.npr.org/2026/08/05/nx-s1-5894884/appalachia-black-lung-coal-miners-silica-dust
4•Jimmc414•23m ago•0 comments

Show HN: Is It an OS?

https://iiao.algor.ist
1•indydevs•24m ago•0 comments

QoD: Is Lucid in the early stages of failure?

https://www.thetruthaboutcars.com/cars/news-blog/question-of-the-day-is-lucid-in-the-early-stages...
1•RickJWagner•25m ago•0 comments

Libraries Are Leading the Fight for Physical Media Ownership

https://www.arl.org/blog/consumers-are-worried-about-the-loss-of-physical-media-ownership-librari...
1•donohoe•25m ago•0 comments

Show HN: MusicMonitor – Turn your extra monitor into a Spotify now-playing view

https://github.com/j-sofia/MusicMonitor
2•j-sofia•26m ago•1 comments

The Investors Whose SpaceX Shares Vanished Before They Could Cash In

https://www.wsj.com/finance/stocks/spacex-ipo-spv-investors-2698a174
4•JumpCrisscross•30m ago•0 comments

AI agents that inherit the user's permissions, not API keys

https://blog.cloudflare.com/how-we-use-ai-with-cloudflare-os/
1•thoughtpeddler•30m ago•0 comments

Industrial Revolution to AI tech upheavals: The Catholic principle guiding popes

https://theconversation.com/the-catholic-principle-guiding-popes-through-tech-upheavals-from-the-...
2•1659447091•34m ago•0 comments

A composer published a paper in physics. His lack of credentials drew criticism

https://retractionwatch.com/2026/08/05/a-composer-published-a-paper-on-theoretical-physics-his-la...
1•unprovable•37m ago•1 comments

China's EV Boom Is Quietly Undermining Oil's Biggest Chokepoint

https://oilprice.com/Energy/Energy-General/Chinas-EV-Boom-Is-Quietly-Undermining-Oils-Biggest-Cho...
1•toomuchtodo•37m ago•0 comments

Country and State Maps in LOTR Style

https://lordofmaps.com/
1•silver92bullet•44m ago•0 comments

The Once-Shameless President Is Deeply Embarrassed

https://www.theatlantic.com/politics/2026/08/trump-humiliated-iran-reflecting-pool/688184/
7•petethomas•45m ago•0 comments

How to Install Python3.14 from source on Ubuntu 26.04

https://jamesoclaire.com/2026/08/06/how-to-install-python3-14-from-source-on-ubuntu-26-04/
1•ddxv•45m ago•3 comments

Thomson Reuters Employees Demand That ICE "Leave Our Cities"

https://www.thenation.com/article/politics/thomson-reuters-ice-immigration-voting-data/
5•petethomas•47m ago•4 comments

OpenAI models shared hacking tips on a messaging board before HuggingFace breach

https://www.politico.com/news/2026/08/05/openai-models-shared-hacking-tips-secret-messaging-board...
2•0in•47m ago•0 comments

Unprecedented images may explain one of greatest mysteries of the sun

https://www.theguardian.com/science/2026/aug/05/unprecedented-images-may-explain-one-of-greatest-...
4•colinprince•51m ago•0 comments

Investors are having doubts about Elon Musk's grandiose ambitions

https://economist.com/business/2026/08/05/investors-are-having-doubts-about-elon-musks-grandiose-...
12•andsoitis•52m ago•4 comments

To Predict the Next Token

https://sanghoon.io/journal/2026-08-04-distillation
1•sanghoonio•53m ago•0 comments

Codex Users Are Losing Banked Rate Limit Resets to a Quiet 30 Day Clock

https://startupfortune.com/codex-users-are-losing-banked-rate-limit-resets-to-a-quiet-30-day-clock/
2•newsomix9xl•53m ago•1 comments

Esp32pin.com: a pinout reference for ESP32 series

https://esp32pin.com/
2•sohkamyung•53m ago•0 comments

Ask HN: Was preamble size a red herring? Cache churn vs. harness costs

1•Marvin_RunAI•53m ago•0 comments

Show HN: Python Concurrency Testing with Frontrun

https://github.com/lucaswiman/frontrun
1•lucaswiman•56m ago•1 comments

Disagreements about AI are usually disagreements about future AI capabilities

https://thezvi.substack.com/p/the-three-ai-pills
2•maxutility•56m ago•0 comments

Show HN: Mirafold – Generative UI for Claude Code, Codex, and Gemini CLI

https://mirafold.com/
1•kserrec•57m ago•0 comments

President Donald J. Trump, an individual, Plaintiff, vs. BBC [pdf]

https://storage.courtlistener.com/recap/gov.uscourts.flsd.703382/gov.uscourts.flsd.703382.106.0.pdf
3•petethomas•57m ago•0 comments

Data centers show their primary colors

https://www.politico.com/newsletters/power-switch/2026/08/05/data-centers-show-their-primary-colo...
2•mapping365•59m ago•0 comments

Nashville uses eminent domain to block data center near zoo

https://www.costar.com/article/970809918/nashville-council-approves-eminent-domain-action-to-halt...
38•mapping365•1h ago•26 comments

AOHP: OS-Level Agent Harness for Personalized, Efficient and Secure Interaction

https://arxiv.org/abs/2606.23449
1•zhaoshanhui•1h ago•0 comments