fix: don't panic RedisCache actor when result receiver is dropped#17
fix: don't panic RedisCache actor when result receiver is dropped#17leeguooooo wants to merge 1 commit into
Conversation
If the caller of CachePoW/RetrivePoW/CacheResult/VerifyCaptchaResult drops the oneshot receiver before the Redis operation completes (e.g. the HTTP client disconnects mid-request), tx.send() fails and the unwrap() panics inside the actor context. The actor dies and every subsequent captcha verification on that instance fails with "Actor mailbox error" until the process is restarted. Ignore the send result instead, matching the existing idiom in master/embedded/master.rs (RemoveCaptcha handler).
realaravinth
left a comment
There was a problem hiding this comment.
Thanks for the bug report and the fix o/
|
I've manually mirrored your patch on https://git.batsense.net/mCaptcha/libmcaptcha/pulls/2. I'll merge it when CI shows green. I'll patch libmcaptcha in cache and mcaptcha over next week. Thanks again for the patch! |
|
Awesome, thanks for merging it so quickly o/ Small heads-up in case it's useful: the red checks here on GitHub aren't from the patch — the If you'd like, I'm happy to send a tiny |
|
Thank you for the offer (and the PR). I intend to slowly move mCaptcha away from GitHub, since not US-based, and the risk of getting locked out is very real. |
Fixes #16.
If the caller drops the oneshot receiver before the Redis operation completes (e.g. an HTTP client disconnects mid-request),
tx.send().unwrap()panics inside the actor context and theRedisCacheactor dies permanently — every captcha verification on that instance then fails withActor mailbox erroruntil the process is restarted. We hit this in production today (details in #16).This ignores the send result in the four
RedisCachehandlers, matching the existing idiom inmaster/embedded/master.rs(RemoveCaptchahandler). The synchronous sends inhashcache.rsare not affected: there the receiver is still in scope whensend()runs, so it cannot fail.Note:
cargo checkon current stable (1.96) fails on master with pre-existing never-type-fallback errors unrelated to this change; the patch compiles cleanly on 1.91.