Comments (5)
I also bumped into this issue. It seems to be a bug with the LRU cache (mirrors/cache.go
)
Mirrorbits uses an internal LRU cache in front of the Redis database: when it needs to request information about a file, it first queries the LRU cache, and if ever the result is in there, it doesn't query the database. Of course, it means that when file information are updated (ie. a scan returns, and updated values are committed to the database), entries in the LRU cache must be invalidated.
This part of the code is problematic:
Lines 141 to 155 in 0d00d9e
The "listener" here is in fact the LRU cache, and the content of the message is a file path. When a scan returns, every file is updated in the database, generating a message in the channel for each file. So it means this function handleMessage
is called many times, as many times as there's files in the repo, every time a scan returns.
However, as is clearly stated in the code snippet above: when the channel is full, mirrorbits doesn't wait for the listeners to consume messages in the channel. Instead it just drops the message. I did a quick test, and around 7% of the messages were dropped. If messages are dropped, the LRU cache is never notified that some files were updated, and so outdated entries are not discarded as they should.
I suppose that, for a busy instance, the issue can easily go unnoticed, as entries in the LRU cache will be evicted anyway (LRU = Least Recently Used). And if ever they are not evicted, the consequence is just that mirrorbits might redirect to fallback, instead of redirecting to valid mirrors.
But for a mirrorbits instance that doesn't receive much traffic, outdated entries can stay there forever, and the issue is very visible. As @zen-fu noted, a restart is enough to fix it (since the LRU cache doesn't survive a restart).
So the easy fix is just to make mirrorbits wait when the channel is full. I'm testing it, it seems to work so far.
from mirrorbits.
In general there is some problem with things getting cached and only "fixing themselves" after some minutes.
from mirrorbits.
We bumped into the same issue but after 12h the situation was still the same.
- Triggering a
mirrorbits refresh
didn't make a difference. - Restarting the service fixed file sizes and hashes.
from mirrorbits.
This issue can be closed now
from mirrorbits.
Thanks!
from mirrorbits.
Related Issues (20)
- Rotation of logs (logrotate) and releasing the rotated inode log file HOT 3
- New downloads "Service Unavailable" HOT 1
- Scan through HTTP/HTTPS possible? HOT 2
- Cannot edit a mirror when its ID is a substring of another HOT 2
- Consider bundling static files HOT 1
- Is this project still maintained? HOT 15
- OSMC still uses MirrorBits HOT 1
- Feature request: support S3 protocol for scanning mirrors
- Mirrorbits stats pile up forever, there should be a way to delete old stats HOT 1
- Unbounded MULTI transactions cause big latency spikes in Redis
- Feature Request: also build for arm64 architecture HOT 3
- Health-Check might check for non-existing files, marking mirror down by mistake. Could be improved HOT 3
- Line-wrapping in YAML output makes life difficult HOT 2
- Support dual HTTP/HTTPS for a mirror
- Consider open data alternative to Geoip db HOT 2
- Redirect to a mirror that is unreachable due to local/remote rules HOT 2
- feature: Support mirror "alias" in addition to name HOT 1
- Feature Request: Trigger scan via changing/monitoring a special file
- Master fails to build with undefined: grpc.ClientConnInterface HOT 17
- Feature Request: Support rsync-ssl for mirrors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mirrorbits.