#prog #article
How to miscompile programs with “benign” data races
Или как "безвредные" гонки данных могут быть вредить программе в контексте легальных оптимизаций компиляторов.
И вдогонку
Benign Data Races: What Could Possibly Go Wrong?
Тоже с конкретными примерами.
How to miscompile programs with “benign” data races
Или как "безвредные" гонки данных могут быть вредить программе в контексте легальных оптимизаций компиляторов.
И вдогонку
Benign Data Races: What Could Possibly Go Wrong?
Тоже с конкретными примерами.
🤔2❤1🤬1
#prog #rust #article
How we found a bug in the hyper HTTP library
Баг присутствовал в нескольких мажорных версиях hyper и, что иронично, проявился в Cloudflare из-за, в конечном счёте, оптимизаций архитектуры. А ещё это хорошее напоминание, что Rust защищает от гонок данных, но не от состояния гонок в целом.
How we found a bug in the hyper HTTP library
None of the tools at the application level surfaced any errors, crashes, or log entries that provided useful clues. Application-level observability can have a blind spot for bugs that live below its awareness.
The failure occurred intermittently, scaled with response size, couldn’t be reproduced with simple tools like curl, and disappeared when we observed the system more closely. These signals pointed to a timing-dependent bug in the connection layer, not in the application logic.
Our breakthrough came from using kernel-level tooling with strace, the one layer that records what actually happened on the socket. The underlying bug lived in the few milliseconds between a partial flush and a premature shutdown — a window that opened only after we made the system faster.
Баг присутствовал в нескольких мажорных версиях hyper и, что иронично, проявился в Cloudflare из-за, в конечном счёте, оптимизаций архитектуры. А ещё это хорошее напоминание, что Rust защищает от гонок данных, но не от состояния гонок в целом.
Cloudflare Blog
How we found a bug in the hyper HTTP library
By rearchitecting the Images binding, we accidentally uncovered a bug that existed in the open-source hyper library across multiple major versions.
👍8
#prog #rust #article #successstory
Rust PNG crate gets even faster, used by GNOME and Chromium
Rust PNG crate gets even faster, used by GNOME and Chromium
Rust png crate, also known as image-png, implements PNG encoding and decoding in safe Rust. It is compliant with the third edition of the PNG specification, including APNG support.
A year ago it was already the fastest PNG decoder in the world. Since then it has gotten even faster.
<...>
image-png is used as the default PNG implementation in Chromium since M139 (August 2025) across all platforms [выделение моё], both on desktop and on mobile.
This required meeting a remarkably high bar in terms of features, performance, correctness, compatibility and security. It would only ship if there were no regressions in any of those categories!
🔥7
#prog #rust #article
It's not me, it's the compiler!
TL;DR: чел писал парсер и обнаружил, что rustc неправильно компилирует код, в котором есть прямой каст из bool в u32 (а если семантически эквивалентный if, то нормально). Баг подтвердили, причиной была некорректная оптимизация на уровне MIR.
It's not me, it's the compiler!
TL;DR: чел писал парсер и обнаружил, что rustc неправильно компилирует код, в котором есть прямой каст из bool в u32 (а если семантически эквивалентный if, то нормально). Баг подтвердили, причиной была некорректная оптимизация на уровне MIR.
❤19😱2
#prog #article
Abstraction: Not What You Think It Is
TL;DR: абстракции — это сугубо умозрительные конструкции, которые не отображаются ни на какую конкретную конструкцию языка программирования напрямую, и в силу своей природы разные абстракции можно строить, не трогая исходный код вообще. Перед тем, как показать определение, автор также перечисляет вещи, которые часто называют абстракцией, но не являются ей в смысле приведённого им определения.
Abstraction: Not What You Think It Is
As the quoted writers show, people do not even agree what abstraction means. <...>
This situation is particularly sad for me as someone with a background in PL theory. There are a lot of topics in software engineering that are the result of accumulated intuition over decades. But we've had a pretty good definition of abstraction since 1977, originally in the context of program analysis, and — I claim — it actually translates quite well into a precise definition of “abstraction” in engineering.
TL;DR: абстракции — это сугубо умозрительные конструкции, которые не отображаются ни на какую конкретную конструкцию языка программирования напрямую, и в силу своей природы разные абстракции можно строить, не трогая исходный код вообще. Перед тем, как показать определение, автор также перечисляет вещи, которые часто называют абстракцией, но не являются ей в смысле приведённого им определения.
👍3❤1❤🔥1
#prog #article
pre-commit hooks are fundamentally broken
pre-commit hooks are fundamentally broken
Please just don't use pre-commit hooks. Use pre-push instead. pre-push hooks nearly avoid all of these issues.
👍11🤔1💯1
#prog #article
My Thoughts on the Bun Rust Rewrite (от Andrew Kelly, создателя Zig)
TL;DR:
Технические замечания, впрочем, тоже есть.
My Thoughts on the Bun Rust Rewrite (от Andrew Kelly, создателя Zig)
TL;DR:
The main issue here had nothing to do with the language features of Zig vs Rust, and everything to do with the diverging value systems of the two projects [Bun и Zig] and the relationship breakdown that followed.
Технические замечания, впрочем, тоже есть.
🤔1🤷1