Bail out on unmounting filesystem

Want something added? Ask for it here.
Post Reply
necreo
Newbie
Newbie
Posts: 3
Joined: August 10th, 2009, 1:24 pm

Bail out on unmounting filesystem

Post by necreo »

I'd like SABnzbd+ to quit downloading when it detects one of the folders (especially the incomplete one) can't be read/written anymore. Now it gets reset to download to "$other_disc/downloads/incomplete", so parts get lost and the download ultimately fails.

I also included (large, relevant parts of) the IRC conversation about this feature.
IRC wrote:.:19:19:42:. another question: is it possible to make sabnzbd pause/quit when it detects one of the folders can't be read? now it gets reset to download to "my documents", but I've got very little free space on that partition
.:19:24:43:. we don't have a check right now for if a folder can't be read, but that wouldn't be a terrible idea. it won't likely make it for 0.5, though, since we're trying to wrap it up right now.
.:19:25:13:. I'll resort for the moment to start it manually
.:19:25:19:. i suggest bringing that up on the forums
.:19:26:02:. a lot of people set sabnzbd to download to a removable disk, and Weird Stuff happens when there are mountpoints involved.
.:19:26:27:. like, if you have sabnzbd set to download to a removable drive, then you unmount that drive, sabnzbd will gleefully continue downloading to the mountpoint.
.:19:26:42:. when you then mount the drive there again, you can't see the stuff it downloaded.
.:19:27:04:. i'm not sure how we'd handle that, but it needs to be something we look into.
.:19:28:23:. inpheaux: that's exactly my problem :)
.:19:28:36:. sabnzbd start before my exhdd got properly mounted
.:19:28:56:. so it defaults to "downloads/incomplete"
.:19:30:59:. doesn't the OS return some errorcode when it continues to write to a, suddenly (pulled the plug or something), unmounted filesystem?
.:19:34:58:. well, i'm not sure if there's a way for us to detect that within sabnzbd. maybe if available space fluxuates wildly, check into it.
.:19:35:51:. i'm just not sure if there's a way to get that kind of os level info into python
.:19:51:11:. in *nix, there's no difference between a folder and a drive
.:19:51:49:. if you can see what device the selected folder is on, you might be able to track it that way
.:19:56:41:. really, a program would only act differently if you told it to not create the directory if it didn't exist
.:19:56:50:. and that assumes you're not putting it in the root of the drive
.:20:06:17:. I don't think the program itself creates the directory (downloads/incomplete) if it didn't exist
.:20:06:33:. it does
.:20:06:36:. I bet the OS does that automatically?
.:20:19:05:. right, it'd be a good thing to bail if a mountpoint no longer exists, but there's no way for us to tell if something's
                        within a mountpoint or not.
.:20:28:06:. it can write there, the problem is the folder no longer exists, depending on what you set it as
.:20:29:52:. i guess we could have it check to see if it has to create a directory in the middle of a download.
.:20:29:59:. wait no, it would always have to do that.
.:20:30:12:. yeah, idunno how we'd fix that.
.:21:36:56:. inpheaux: duz: I was just downloading something & I pulled the plug (J: is my external harddrive)
> 2009-08-10 21:34:15,937 ERROR [assembler] Disk error on creating file J:\Shared\Incomplete\ubuntu.199\ubuntu_9.04.iso
> 2009-08-10 21:34:15,953 ERROR [sabnzbd.misc] Failed making (J:\Shared\ubuntu)
> 2009-08-10 21:34:15,953 ERROR [postproc] Error renaming "J:\Shared\_UNPACK_ubuntu" to "J:\Shared\_FAILED_ubuntu"
.:21:37:02:. can't it quit @error 1?
.:21:37:53:. maybe?
.:21:38:07:. actually, switch, what do you think of this?
...
                     
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Bail out on unmounting filesystem

Post by shypike »

Mounting drives is done invisibly by the OS.
It's next to impossible to detect this problem in a reliable  way that is portable across operating systems.
I don't think it's something that should be in SABnzbd anyway.

Bear in mind that SABnzbd is designed to implement completely automated solutions (usually server-based).
Having it cope with suddenly disappearing external drives somehow doesn't look like core functionality to me.
Just make sure your drive is mounted before starting SABnzbd and don't pull the cable during downloading.

A general "force pause when encountering a fatal error" would be an interesting idea.
But this will mean a pause, when a error occurs, it will not prevent the first error from occurring.
necreo
Newbie
Newbie
Posts: 3
Joined: August 10th, 2009, 1:24 pm

Re: Bail out on unmounting filesystem

Post by necreo »

shypike wrote: ...
A general "force pause when encountering a fatal error" would be an interesting idea.
But this will mean a pause, when a error occurs, it will not prevent the first error from occurring.
That's perfect. Some option in config where we can specify what to do if such an error occurs (in my case I would chose to pause).
I can make scripts for Windows/Linux not to start SABnzbd+ when the external drive isn't mounted anyways, so that's not the problem.

Thanks a lot if you can implement that in some future version :)
Post Reply