[Backgroundrb-devel] backgroundrb fails when running as win32 service

Daniel Greig dgreig at magian.com
Fri Aug 25 01:21:37 EDT 2006

I've been playing with backgroundrb to batch process a bunch of images 
on a rails server. The process is working fine when backgroundrb is 
started from the command line, but seems to choke occasionally (well, 
quite often) when running as a service. It seems to get stuck on the 
following line when moving files:
FileUtils.move(src, dest, :verbose => true)

with the error:

Bad file descriptor - (Errno::EBADF)

For a while I thought it may have been a file permissions/file access 
issue, but I have seen another error where the process fails at a "puts" 
statement. I have a suspicion that the error may be occurring when ruby 
tries to write to the standard output using "puts". Since the "verbose" 
argument  sends a message to the standard output, it could be failing 
for the same reason and just looking like a file move error.
I have removed all puts statements and all verbose method calls and the 
service *seems* to be more reliable (although it's to early to say as I 
have to do a lot more testing). Has anyone seen any similar problems 
with the win32 service?

My fingers are crossed that getting rid of the puts statements fixes the 
problem, but I'm nervous that it may be something else entirely - anyone 
have any ideas?

More information about the Backgroundrb-devel mailing list