-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
[FR]: Ignore torrents with less than x time active #619
Comments
Here are the logs for easier access when qbitman and cross-seed collided: Sadly hardlinks have a single, unified Access/Modify/Change timestamps for stats, so that cannot be used for pre-checks. Or some other improvement to the code to reduce the window of collision. |
Just to be clear that I understand this properly... AFTER qbm did its indexing of the torrent list, cross-seed linked a torrent's structure that was found in the orphaned data since qbm had no awareness of this torrent in its list of active torrents? |
cross-seed linked and added a torrent, but then qbm decided that the linked files doesn't belong to a torrent and moved it to orphaned. I also see this in the qbit logs:
So the timeline was something like this:
|
I think whether the 3rd and 4th steps happened in that order is kind of irrelevant... One solution I would just float for consideration would be that, at least in the orphaned data - since it has rather big significance deleting files - perhaps waits to perform the orphaned actions until the end of processing in a batch, and then reindexes the torrent list to make sure nothing has changed DURING the orphaned job run (or before it AFTER the indexing, whenever that is) - and double checking the torrent list against the "updated" list before acting on any data deemed orphaned. This avoids the need for an additional (and mis-configurable) option, while more thoroughly addressing potential pitfalls. I'm not sure if other jobs qbitm runs could benefit from this approach because of race conditions, but it seems like something to consider. Especially given that pulling a torrent list is negligible for automated background processes. |
Looking at the code qbm seems to be checking the disk first, then it gets a fresh list of torrents for their files: qbit_manage/modules/core/remove_orphaned.py Lines 34 to 48 in 9f08404
So all I can think of is that it went something like:
|
That's sort of crazy. Thanks for digging into the code, it does appear @bobokun is already doing this. The thing is, that window has to be absolutely microscopic given that it's only AT THE MOST as large as the time between when we start linking and when we inject the torrent. In a normal scenario, I'd say it would be less than a second. I guess you could always recheck it twice (seems like the wrong approach), after the exclude patterns or something before acting on it, but I'm not even sure this is likely to occur at all regularly. Bobo will have more of an idea than me on this. You have to be matching and injecting a torrent in a ~1-second window WHILE qbitmanage is running and indexing its orphaned files. Let me know when we're going to Vegas. |
Yeah, it seems like one in a million chance to happen. I'm not sure if it would worth the effort and performance hit to check the |
Is your feature request related to a problem? Please elaborate.
Not necessarily a qbitmanage problem, it runs as it should. However, in scenarios where external programs like cross-seed are adding torrents to qbittorrent, there's a small window where if both are running at the same time, the rem_orphaned job will remove torrents where the data hasn't finished linking - this happened to a user here, which resulted in those cross seeds starting to redownload.
Describe the solution you'd like
Implementing an
ignore_age
(or some other naming, unsure what's clearest) - which could be global or specificaly for orphaned data config. Trying to think if this could help protect against other edgecases, maybe in cases whereforce_auto_tmm
is used?Does your solution involve any of the following?
Describe alternatives you've considered
An alternative would be to ensure external programs do not run at the same time as qbitmanage, which would reduce the chances of this case happening - however this wouldn't fully prevent it as cross-seed can use announces from rss feeds.
Who will this benefit?
Can see this benefitting all cross-seed users and potentially others that use external programs to inject torrents into qbittorrent.
Additional Information
No response
The text was updated successfully, but these errors were encountered: