-
Notifications
You must be signed in to change notification settings - Fork 3
Fix multi-instance state coordination with file locking and expiration persistence [minor] #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…n persistence When multiple Traefik routers use this plugin, each creates a separate instance that competes for the same state file. This caused verified IPs to lose their TTLs and get re-challenged across instances. Changes: - Add expiration timestamps to State struct for proper TTL serialization - Implement file locking (flock) to prevent concurrent write conflicts - Add state reconciliation to merge in-memory and file-based state - Persist verified IPs immediately after CAPTCHA success (lightweight) - Keep periodic full state saves (1 min) as backup for rate/bot caches Verified IPs now maintain their TTLs across plugin instances, preventing unnecessary re-challenges when requests hit different routers.
|
going to sit on this for a little bit. perhaps deploy locally in a prod environment for a stress test. i am worried about the iops added on the excessive state reconciliation between memory and disk. Since we can't use syscalls in traefik plugins we can't know about writes to the state file shared across services/memory. That leaves us with needing to lock and reconcile disk and memory pretty aggressively. Though since it's happening in a go routine should be fine since it won't be locking/blocking during requests |
we probably aren't getting hit across services with the same ip before we're in a reconcile loop
d9339b0 to
6e1d2ae
Compare
8bd020f to
6957ca8
Compare
6957ca8 to
e53010a
Compare
c61b716 to
1291ff0
Compare
1291ff0 to
25f5131
Compare
use synctest to test state expiry
1563505 to
67c20cd
Compare
67c20cd to
15b5a32
Compare
When multiple Traefik routers use this plugin, each creates a separate instance that competes for the same state file. This caused verified IPs to lose their TTLs and get re-challenged across instances.
Changes:
Verified IPs now maintain their TTLs across plugin instances, preventing unnecessary re-challenges when requests hit different routers.
Closes #52 #18