frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Subsecond: A runtime hotpatching engine for Rust hot-reloading

https://docs.rs/subsecond/0.7.0-alpha.1/subsecond/index.html
104•varbhat•8h ago

Comments

mmastrac•7h ago
I'll have to give this a shot for some of the Rust server work I'm doing. progscrape.com uses a lot of tricks to boot quickly specifically because of the edit-compile-run cycle being slow (mostly deferred loading of indexes, etc).

My current day job @ Gel has me working on a Rust socket frontend for some pretty complex code and that could also be pretty interesting.

It seems to require that you choose a good "cutover" point in your codebase, but TBH that's probably not too hard to pick. The HTTP service handler in a webserver, the socket handlers in non-web serving code, etc.

It does appear to have a limitation where it will only allow the main crate to be hotpatched. That's less than ideal, but I suppose the convenience might justify some code structure changes to allow that.

jkelleyrtp•5h ago
Creator here - haven't had a chance to write up a blog post yet! Stay tuned.

The gist of it is that we intercept the Rust linking phase and then drive `rustc` manually. There's some diffing logic that compares assembly between compiles and then a linking phase where we patch symbols against the running process. Works across macOS, Windows, Linux, iOS, Android, and WASM. On my m4 I can get 130ms compile-patch times, quite wicked stuff.

We handle the hard parts that the traditional dylib-reloading doesn't including TLS, statics, constructors, etc.

I've been posting demos of it to our twitter page (yes twitter, sorry...)

- With bevy: https://x.com/dioxuslabs/status/1924762773734511035

- On iOS: https://x.com/dioxuslabs/status/1920184030173278608

- Frontend + backend (axum): https://x.com/dioxuslabs/status/1913353712552251860

- Ratatui (tui apps): https://x.com/dioxuslabs/status/1899539430173786505

Our unfinished release notes are here:

https://github.com/DioxusLabs/dioxus/releases/tag/v0.7.0-alp...

More details to come!

1oooqooq•3h ago
can't access the xitter posts... is the axum part using the whole of dioxus or bare axum + code reloading?
jkelleyrtp•3h ago
There's a custom `axum::serve` equivalent we built that wraps the router construction in a hot-patchable function. When the patches are loaded, we reset the TCP connections.

It's a little specific to how dioxus uses axum today, but we plan to release an axum-only integration in the future.

weinzierl•5h ago
Very nice. For a long time I wondered who would use hotpatching but working with large Java applications made me appreciate the possibility even if it is not 100% reliable (as it is in Java).

From the docs Subsecond looks almost perfect. The only downside I found is that (if I understood correctly) you have to modify the function call in the source code of every function you want to hotpatch.

It is a bit mitigated in that the change does not cost anything in release builds, but it still is a big thing. Do I want sprinkle my code with call for every function I might potentially have to patch in a debugging session?

jkelleyrtp•4h ago
Creator here - you only need one `subsecond::call` to hook into the runtime and it doesn't even need to be in your code - it can be inside a dependency.

Currently Dioxus and Bevy have subsecond integration so they get automatic hot-patching without any end-user setup.

We hope to release some general purpose adapters for axum, ratatui, egui, etc.

weinzierl•3h ago
Very nice! Thanks.
prideout•5h ago
Neat but I would prefer simply using a dylib for the part of my code that I want to be reloadable.
modeless•4h ago
Interesting, but the documentation makes it sound like you have to preemptively wrap all the code you think you might want to change in a special wrapper "call" function. If true that makes this a lot less appealing than existing solutions for other languages that can modify any function without special annotations.
jkelleyrtp•3h ago
You basically need to wrap your program's `tick()` function. Otherwise you might be in the middle of malloc, hot-patch, and your struct's layout and alignment changes, and your program crashes due to undefined behavior.

The goal is that frameworks just bake `subsecond::current` into their `tick()` function and end-users get hot-patching for free.

jesse__•1h ago
How would you preempt the running program during malloc? Isn't there a well-defined reload point? Major red flags going up if your program can just change at any random point..

Also, didn't the article say explicitly that struct layout changes aren't supported??

anderskaseorg•1h ago
There is a well-defined reload point—it’s the `subsecond::call` wrapper around `tick()`. But the hypothetical design that you seem to have in mind where this doesn’t exist would not have a well-defined reload point, so it would need to be able to preempt your program anywhere.

Layout changes are supported for structs that don’t persist across the well-defined reload point.

jesse__•1h ago
Strong agree here. The 'purity' BS of not modifying the running programs address space appears to come at the cost of significant programmer pain-in-the-ass. Having to hand-hold the library to maintain the indirection table is a hard no for me.

Metaprogramming that maintenance burden seems like it should be relatively straight-forward, if you've written a linker already.

jkelleyrtp•39m ago
The challenge is that if the program is busy in a spin loop, there's no way to preempt it and modify it. Things like malloc, spin loops, network requests, syscalls etc.

I looked into liveplusplus a lot and their unreal integration also requires a broker to get the most out of it. If you're building a game engine and want to support struct layout and alignment changes, you'll need to do some re-instancing. Hiding a `subsecond::call` deep in the bowels of the host framework hides it from the user and lets the framework handle any complicated state management it needs during hotpatches.

I wouldn't say it's purity - the first version of subsecond actually did do in-process modification - but after playing around with it for a while, I much preferred the light runtime integration. The dioxus integration was about 5 lines of code, so it's quite minimal.

written-beyond•1h ago
I really want rust dylibs to be a reality. A plugin system where a library can implement a specific versioned number of a trait and we can dynamically load in that implementation to get changed behaviour. Right now implementing anything like that requires a lot of unsafe which I'm not comfortable with.
cyberax•19m ago
Can we have the same for Go, pretty please?

Microsoft Releases Classic MS-DOS Editor for Linux Written in Rust

https://github.com/microsoft/edit
107•ethanpil•3h ago•60 comments

Fun with uv and PEP 723

https://www.cottongeeks.com/articles/2025-06-24-fun-with-uv-and-pep-723
366•deepakjois•9h ago•117 comments

Writing toy software is a joy

https://blog.jsbarretto.com/post/software-is-joy
553•bundie•12h ago•232 comments

ChatGPT's enterprise success against Copilot fuels OpenAI/Microsoft rivalry

https://www.bloomberg.com/news/articles/2025-06-24/chatgpt-vs-copilot-inside-the-openai-and-microsoft-rivalry
179•mastermaq•11h ago•161 comments

Thick Nickels

https://thick-coins.net/?_bhlid=8a5736885893b7837e681aa73f890b9805a4673e
47•jxmorris12•3h ago•14 comments

Managing time when time doesn't exist

https://multiverseemployeehandbook.com/blog/temporal-resources-managing-time-when-time-doesnt-exist/
50•TMEHpodcast•3h ago•32 comments

Mid-sized cities outperform major metros at turning economic growth into patents

https://www.governance.fyi/p/booms-not-busts-drives-innovation
36•guardianbob•4h ago•29 comments

PlasticList – Plastic Levels in Foods

https://www.plasticlist.org/
324•homebrewer•13h ago•143 comments

Build your first iOS app on Linux / Windows

https://xtool.sh/tutorials/xtool/first-app/
26•todsacerdoti•2h ago•1 comments

Ancient X11 scaling technology

https://flak.tedunangst.com/post/forbidden-secrets-of-ancient-X11-scaling-technology-revealed
192•todsacerdoti•8h ago•146 comments

Canal Boat Simulator

https://jacobfilipp.com/boat/
33•surprisetalk•2d ago•9 comments

Finding a 27-year-old easter egg in the Power Mac G3 ROM

https://www.downtowndougbrown.com/2025/06/finding-a-27-year-old-easter-egg-in-the-power-mac-g3-rom/
320•zdw•14h ago•89 comments

PicoEMP: low-cost Electromagnetic Fault Injection (EMFI) tool

https://github.com/newaetech/chipshouter-picoemp
4•transpute•50m ago•0 comments

Subsecond: A runtime hotpatching engine for Rust hot-reloading

https://docs.rs/subsecond/0.7.0-alpha.1/subsecond/index.html
104•varbhat•8h ago•16 comments

XBOW, an autonomous penetration tester, has reached the top spot on HackerOne

https://xbow.com/blog/top-1-how-xbow-did-it/
173•summarity•12h ago•88 comments

How to Think About Time in Programming

https://shanrauf.com/archive/how-to-think-about-time-in-programming
87•rmason•7h ago•29 comments

The bitter lesson is coming for tokenization

https://lucalp.dev/bitter-lesson-tokenization-and-blt/
223•todsacerdoti•13h ago•96 comments

Starship: The minimal, fast, and customizable prompt for any shell

https://starship.rs/
385•benoitg•16h ago•180 comments

National Archives at College Park, MD, will become a restricted federal facility

https://www.archives.gov/college-park
268•LastTrain•6h ago•78 comments

The Jumping Frenchmen of Maine

https://www.amusingplanet.com/2025/06/the-jumping-frenchmen-of-maine.html
29•bookofjoe•2d ago•3 comments

Basic Facts about GPUs

https://damek.github.io/random/basic-facts-about-gpus/
247•ibobev•15h ago•55 comments

Show HN: VSCan - Detect Malicious VSCode Extensions

https://vscan.dev/
30•shadow-ninja•5h ago•22 comments

Playing First Contact in Eclipse, a 3-Day Sci-Fi Larp

https://mssv.net/2025/06/15/playing-first-contact-in-eclipse-a-spectacular-3-day-sci-fi-larp/
3•adrianhon•2d ago•0 comments

Gemini Robotics On-Device brings AI to local robotic devices

https://deepmind.google/discover/blog/gemini-robotics-on-device-brings-ai-to-local-robotic-devices/
165•meetpateltech•13h ago•65 comments

Advanced Python Function Debugging with MCP Integration

https://github.com/kordless/gnosis-mystic
6•kordlessagain•2d ago•0 comments

Show HN: Autumn – Open-source infra over Stripe

https://github.com/useautumn/autumn
106•ayushrodrigues•15h ago•32 comments

Mapping LLMs over excel saved my passion for game dev

https://danieltan.weblog.lol/2025/06/map-llms-excel-saved-my-passion-for-game-dev
51•danieltanfh95•3d ago•18 comments

Expand.ai (YC S24) is hiring a founding engineer

1•timsuchanek•10h ago

Few Americans pay for news when they encounter paywalls

https://www.pewresearch.org/short-reads/2025/06/24/few-americans-pay-for-news-when-they-encounter-paywalls/
20•mooreds•1h ago•20 comments

Timdle – Place historical events in chronological order

https://www.timdle.com/
160•maskinberg•1d ago•51 comments