I’m trying to create a win32-service (ruby script with Rails
environment) utilizing the Daemon class and it currently prematurely
exits when it encounters a method of mine that calls a delivery via
ActionMailer.
Here is the process:
Windows Service (Ruby script Daemon class)
|
v
MyModel.save (from within the Ruby script via requiring the Rails
environment)
|
v
after_create :deliver_notification
This causes my Daemon to exit. Has anyone tried anything similar? I’ve
tried breaking the MyModel.save off onto another thread with no luck.
I don’t know if the problem is the time required to deliver the message
or if it’s because ActionMailer uses its own Daemon.
Anyone have any thoughts?
Just an update, the exception I am capturing is a “Bad file descriptor”
exception. The actionmailer model and method work well outside the
windows service.
Permissions problem maybe? I have a vague association in my mind
between that error and server not being accessible…
What credentials does your service run under? Is it an account
w/network permissions?
From the command line in an interactive session? That’s != the
environment you get when you’re running from a service…
If you haven’t already, just for a goof, temporarily have the service
run under your domain credentials & see if it makes a difference.
Roy P. wrote:
From the command line in an interactive session? That’s != the
environment you get when you’re running from a service…
If you haven’t already, just for a goof, temporarily have the service
run under your domain credentials & see if it makes a difference.
Sadly that didn’t make a difference. I even tried to log out and back
in again, which still caused the same exception to be logged.
Can a daemon such as ActionMailer’s delivery methods be called from
within another daemon (win32-service)?
Vic.
I have what seems to be a solution. The problem was unrelated to
ActionMailer. In reality the problem was occurring because of a few
constants that were declared in multiple places. When MyModel
re-declared these constants this error (Bad File Descriptor) would be
being thrown.
Roy P. wrote:
Permissions problem maybe? I have a vague association in my mind
between that error and server not being accessible…
What credentials does your service run under? Is it an account
w/network permissions?
Thanks for replying! I seem to have full permissions from the command
line and everything else works from the service except the mailer. I
don’t forward any credentials to the mailer concerning my actual login
either.