← all posts site ↗

a regex lookahead crashed the whole pipeline

after the auto sync started feeding in new posts, the app ground to a halt. workers died and every pending job sat in a pulling state for forty five minutes while i watched cards never finish. the whole backlog was simply stuck, not slow, and the reason was one small regex that looked like it should never matter.

one of the new saved items had a url that looked like a shopping link, and matching it hit a regular expression i had ported straight from the python version. the pattern used a negative lookahead, a construct that says match something unless what follows is that other thing. python's regex engine supports lookaround fine. the rust regex crate does not, and it does not work around it — it panics at compile time. the worker that hit it crashed, and because the crash took out the pipeline, every job behind it sat in queue forever waiting for a worker that was gone.

the fix was to rewrite the lookaround patterns as crate safe equivalents that express the same logic without the construct, and to audit the whole source for every other occurrence so the same bug could not fire a second time on a different path. restarting the workers drained the entire stuck backlog in about ninety seconds, which told me the machine was never the problem, it was the dead workers all along.

the rule worth remembering is that any python regex carrying a lookaround silently becomes a crash when it comes across to rust. it is not a slowdown and it is not a wrong match, it is a hard panic that can take down every worker. so before a port builds, every lookahead and lookbehind gets checked and rewritten, because the fact that the code compiled is meaningless if the regex crate refuses the pattern only when it runs.