Page 1 of 1

Orphaned Jobs wiped my drive?!

Posted: March 4th, 2025, 1:44 pm
by SABdeletedData48
I noticed I had orphaned jobs in the Status and interface page, so I hit "Queue Repair." This just deleted 6TB of data that I cannot find. What the hell just happened?! Why is SABNzb showing folder structure that is capable of being deleted in here?!

Is there any way to get the data back or am I just out the last 20 years of data I had on that drive? NZBs were stored on a drive that had other folders on it from the rest of my life. I am running this on my macbook, MacOS 10.15.7.

Re: Orphaned Jobs wiped my drive?!

Posted: March 4th, 2025, 2:37 pm
by safihre
No files are deleted during queue repair, as far as I know.

Re: Orphaned Jobs wiped my drive?!

Posted: March 5th, 2025, 7:09 am
by SABdeletedData48
It cleared a 6TB hard drive with no option to restore, so I can politely call BS on "no files are deleted."

Re: Orphaned Jobs wiped my drive?!

Posted: October 13th, 2025, 12:08 am
by throwaway2050
This just happened to me after deleting orphaned jobs. It's literally the only action I took on a particular drive that could have possibly caused it. It's clearly rare, since google found nothing other than this thread. But it would make this thread a hell of a coincidence if something else caused it.

I've never looked at the sabnzbd source code but i am a programmer so I assume what must be happening is that deleting orphaned jobs deletes the temp folder, which in this particular case was the main directory of a media drive I have. Again, I haven't looked at the code, so I'm not sure how the program stores orphaned data, along with how it deals with freeing up that space. If truly all it is doing is wiping the temp folder, then I assume the intent was to keep the code simple, but that is incredibly lazy programming.

Re: Orphaned Jobs wiped my drive?!

Posted: October 14th, 2025, 2:22 pm
by safihre
It lists the folders in the temp folder and compares those to the ones in the queue. All folders not used by queued items will be removed.
How else do you suppose it should work?

Re: Orphaned Jobs wiped my drive?!

Posted: October 15th, 2025, 3:12 am
by throwaway2050
safihre wrote: October 14th, 2025, 2:22 pm It lists the folders in the temp folder and compares those to the ones in the queue. All folders not used by queued items will be removed.
How else do you suppose it should work?
This is like saying, "I've marked the trash as trash, but instead of throwing out things marked as trash, I'm going to throw out anything not marked not-trash". Lazy, indirect, arm-length programming.

Re: Orphaned Jobs wiped my drive?!

Posted: October 15th, 2025, 4:16 am
by safihre
We don't mark it as trash, it's just folders we don't have any reference to. So they must be some crashed job that we could not recover.
If we had a reference for it, it wouldn't be an orphan. Hence the name.
Nobody should be using our temporary folder except us...
Why place anything in there?

Re: Orphaned Jobs wiped my drive?!

Posted: October 15th, 2025, 12:16 pm
by Puzzled
Using the root of a drive that you have filled with other stuff as temp isn't the best idea, but someone who does that will probably click delete on auto pilot as well. You could add a verification step to make it very clear what's going on. "Are you sure you want to DELETE all these directories?" and then list them again.

throwaway2050: It does list the "trash" in the window below the wipe all button. All the directories you lost would have been listed there.

Re: Orphaned Jobs wiped my drive?!

Posted: October 16th, 2025, 12:01 am
by throwaway2050
Puzzled wrote: October 15th, 2025, 12:16 pm Using the root of a drive that you have filled with other stuff as temp isn't the best idea, but someone who does that will probably click delete on auto pilot as well. You could add a verification step to make it very clear what's going on. "Are you sure you want to DELETE all these directories?" and then list them again.

throwaway2050: It does list the "trash" in the window below the wipe all button. All the directories you lost would have been listed there.
For the record, this particular drive is used for temp usenet downloads, not as a storage for curated media. So I never bothered creating a sub-directory for temp files. Since there was space, I had thrown some other random non-curated media on there. That's how I discovered this. It wasn't as huge a deal as the tone of my second comment may have implied. But I don't buy that people can't fathom the sort of setup I've described above, or that the feature "delete orphaned jobs" doesn't connote "the entire directory will be wiped" to everyone using the software.
safihre wrote: October 15th, 2025, 4:16 am We don't mark it as trash, it's just folders we don't have any reference to. So they must be some crashed job that we could not recover.
If we had a reference for it, it wouldn't be an orphan. Hence the name.
Nobody should be using our temporary folder except us...
Why place anything in there?
I do appreciate the elaboration. However, if all references to the data have been lost, why would there even be a "delete orphaned jobs" feature? This might come across as nitpicky but even rebranding to something like "clear temp directory" would be an improvement. "Delete orphaned jobs" doesn't appropriately describe everything the operation does.

Re: Orphaned Jobs wiped my drive?!

Posted: October 16th, 2025, 2:43 am
by safihre
I will add an additional warning that clicking Clear all results in wiping.

Re: Orphaned Jobs wiped my drive?!

Posted: October 17th, 2025, 10:16 am
by sander
> Nobody should be using our temporary folder except us...
> Why place anything in there?

So this about users that override SABnzb'd default Incomplete/temp directory "~/Downloads/incomplete" and point it to a general directory (or Downloads/complete, or maybe the root of a drive, so "/media/mybigdrive/" )? Or the other way around: put non-SABnzbd stuff into "~/Downloads/incomplete"

If so, then I now understand.

> I will add an additional warning that clicking Clear all results in wiping.

So ... Windows-style "Are you sure you're sure?"? ;-)

How about this: SABnzbd should consider a directory orphaned if and only if:

SAB has no reference to it

AND

the directory contains the unique SABnzbd signature ".../__ADMIN__/SABnzbd..."

I expect it will find 99+% of orphaned jobs / directories, and avoid the above problems.

Re: Orphaned Jobs wiped my drive?!

Posted: October 17th, 2025, 10:48 am
by safihre
This is really for crash recovery. So it could be due to some race condition that there is no admin dir..
So it's fine liks this. With an extra chec. And text that explains what will happen.

Re: Orphaned Jobs wiped my drive?!

Posted: October 17th, 2025, 7:24 pm
by throwaway2050
sander wrote: October 17th, 2025, 10:16 am How about this: SABnzbd should consider a directory orphaned if and only if:

SAB has no reference to it

AND

the directory contains the unique SABnzbd signature ".../__ADMIN__/SABnzbd..."

I expect it will find 99+% of orphaned jobs / directories, and avoid the above problems.
This is what I was going to reply to the question "How else were we supposed to do it?" but it's such an obviously better way of doing it, and paired with the fact I haven't actually seen the source code, well I didn't want to be overly presumptive before knowing for sure that there wasn't some really good reason why it was done this other way. Then when the admin said it's done bc there's no reference to orphaned data, I just became even more confused. Idk, must be my C training, but I can't really conjure a situation where I'd write programs where I end up losing references to data that some operation somewhere will still need to deal with. Even when I'm positive no user could mess things up.