[Mongrel] Win32 service - Errno::EINVAL(Invalidargument)whenuploading image file

Herryanto Siatono herryanto at gmail.com
Sun Apr 29 09:03:13 EDT 2007

No worries Louis, have been grateful for the existence of Mongrel, glad to
know those few issues are going to be resolved.

Thanks for the safer workaround. And you have a good weekend too.


-----Original Message-----
From: mongrel-users-bounces at rubyforge.org
[mailto:mongrel-users-bounces at rubyforge.org] On Behalf Of Luis Lavena
Sent: 29 April 2007 13:19
To: mongrel-users at rubyforge.org
Subject: Re: [Mongrel] Win32 service -
Errno::EINVAL(Invalidargument)whenuploading image file

On 4/29/07, Herryanto Siatono <herryanto at gmail.com> wrote:
> Without your step through, I wouldn't have found it, thanks anyway!
> Btw, isn't it a bit harsh to throw an error when puts is called in mongrel
> service? Coz sometimes the 'puts' was called by core library, eg. This
> the Base64.

Well, thats a design flaw, from mongrel_service I must admit, and from
Windows Services too (I'm 100% responsible for this).

Is not the service who thow it, is the ruby interpreter that tried to
write to the standard Out, even if they don't have a valid console

One workaround is replace ruby.exe with rubyw.exe, which ignores
everything that is console related, but found that brakes the new
service implementation (WiP, not in repository).

> Right now, I'm applying a patch to my app to ignore the stderr/stdout, and
> the app works fine now:
> class StdOutLogger
>   def write(s)
>        # do nothing
>     end
>   end
> end
> before_filter {
>   $stdout = $stderr = StdOutLogger.new
> }
> Was wondering, if there's variable to call to find out if the code is
> running on mongrel_service? So I can do simple filtering only to ignore
> sterr/out when running as a service.

The safer solution is redirect STDOUT and STDERR from ruby:


> If not is there a way to pass a variable when starting mongrel_service? I
> tried
> mongrel_service console single -c
> d:/rubywork/[appname]MONGREL_TYPE='service'

Currently there isn't. Adding environment variables prior starting
child process is currently in my TODO for new service implementation.

Also, the STDOUT/ERR problem (ala, puts) will be solved too. Must
tweak a few things with x64 platforms and do some testing.

> But no luck! :)

I know, I know, shame on me :-P

Regards and good weekend.

Luis Lavena
Multimedia systems
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
Mongrel-users mailing list
Mongrel-users at rubyforge.org

More information about the Mongrel-users mailing list