# Forum: Rails deployment Mongrel as service....odd

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
on 2007-02-20 11:11
I have an odd ( at least for me ) problem with Mongrel running as
service.
Im trying to deploy RoR on a Win2003 server using Mongrel as service
and isapi rewriter for IIS.
When i run mongrel from shell (ruby script/server -p 4000) i can use
my application with no problem of any sort.
When i use mongrel running as service i get a "invalid argument" error
and when i hit the refresh button the controller works fine.
Is there any difference in mongrel running in shell mode or service
mode?

Another question: is there any HowTo for dummies on how to install and
deploy RoR on a fresh linux based server?

Thanks in advance.
on 2007-02-20 14:12
On 2/20/07, Fausto <dieffe@gmail.com> wrote:
> mode?
>

Fausto, in the future will be really helpful if you provide versions
of the gems (mongrel & rails) you're using.

In the past, mongrel_service (0.1.0) used to duplicate mongrel_rails
code to implement as service. Since latest release (0.3.1), that is
replaced with original mongrel_rails code (totally DRY).

My suggestions:

1) Since you said you tested your application with webrick, I'll try
doing it with mongrel_rails

> cd c:\path\to\my\app
> mongrel_rails start -p 4000

Check if it works or not. (browse to your app URL directly
http://localhost:4000/).

2) If that worked, now perform the same with mongrel_service 'console'
functionality:

> mongrel_service console single -c "c:\path\to\my\app" -p 4000

Please note that: quotes for path are required if spaces to folders
are used. console and single parameter are needed: they inform
mongrel_service that you will simulate the service and single is the
one ruby-process service bundled into the executable.

3) If all these things worked, that indicates something is wrong with
the command line of the service itself (called Image Path).

Check the Services console from the Administrative Tools (or
click on it.

Verify the command line (Executable Path) looks something like this:

C:\Ruby\bin\mongrel_service.exe single -c "c:\path\to\my\app" -p 4000

IMPORTANT NOTE: since you say you're using IIS rewrite, I'll suggest
you check these rules in case all the previous instructions worked.

Also, you didn't indicate "production" environment, please check your
development database is set in config/database.yml and you're sure to
run it that way.

> Another question: is there any HowTo for dummies on how to install and
> deploy RoR on a fresh linux based server?
>

Not my field of action :-)

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-20 21:24
First of all thanks for your reply,
the versions im using are:

Ruby 1.8.5
RubyGem 0.9.0
Rails 1.2.1
Mongrel_Service 0.3.1
Mongrel 1.0.1

I tryed as you suggested and when i run mongrel via command line
mongrel_rails start -p 4000 no problem, running the server version via
console took me to the problem as i copy pasted as follows:

Errno::EINVAL in Contatti#lista
Showing app/views/contatti/lista.rhtml where line #16 raised:

Invalid argument

Any hints?

Thanks
on 2007-02-20 21:35
On 2/20/07, Fausto <dieffe@gmail.com> wrote:
> I tryed as you suggested and when i run mongrel via command line
> mongrel_rails start -p 4000 no problem, running the server version via
> console took me to the problem as i copy pasted as follows:
>

so mongrel_rails start worked when you tried access that page, but the
console service didn't?

What contains app/views/contatti/lista.rhtml where line #16 ?

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-21 16:12
<td width="50"><div align="center"><%= link_to_image("delete.gif",
{:controller => 'contatti', :action => 'cancella', :id =>
contatti}, :confirm => 'Eliminare?', :method => :post, :border=>0) %></
div></td>

line 16

Here it is the model:

class Contatti < ActiveRecord::Base

file_column :image

belongs_to :"collega",
:class_name => "Referenti",
:foreign_key => "referente_id"
belongs_to :"collega2",
:class_name => "Professioni",
:foreign_key => "professione_id"
belongs_to :ruolo
belongs_to :quartieri

validates_presence_of :nome, :message => ", Specificare il nome"
validates_presence_of :cognome, :message => ", Specificare il cognome"
validates_uniqueness_of :cognome, :scope => [:cognome, :nome]

validates_associated :collega
end
on 2007-02-22 15:14
On 2/21/07, Fausto <dieffe@gmail.com> wrote:
> class Contatti < ActiveRecord::Base
> belongs_to :quartieri
>
> validates_presence_of :nome, :message => ", Specificare il nome"
> validates_presence_of :cognome, :message => ", Specificare il cognome"
> validates_uniqueness_of :cognome, :scope => [:cognome, :nome]
>
> validates_associated :collega
> end
>
>

You have a backtrace? since you're showing me "contatti" in the view,
that means you're getting contatti = Contatti.find(...) somewhere in

Also check tabs and whitespaces since .rhtml (erb) is a bitch parsing
them

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-24 21:06
The Contatti class is properly defined in the model since i can access
it via both console and browser running mongrel not as service.
Do you suggest that the whitespace policy is different from the
service and non service version of mongrel?

Thanks
on 2007-02-24 22:18
On 2/24/07, Fausto <dieffe@gmail.com> wrote:
>
> The Contatti class is properly defined in the model since i can access
> it via both console and browser running mongrel not as service.
> Do you suggest that the whitespace policy is different from the
> service and non service version of mongrel?
>

Since services execute with a user account other than your (actually,
the run using LocalService account). They cannot access a lot of
things, these could be: directories, networked drives, etc.

Often these problems are related to permissions. I file marked just
for you will fail tried to access under a service, but this isn't the
case.

Without the backtrace, I cannot help you deep into the problem, since
I cannot recreate here these conditions.

Also, the command line used to start the service is very important, if
you could access service manager (Start->Run...->services.msc) and

Regards,

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-26 17:24
Hi.

I too am having the same symptoms:

Backtrace:
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/deprecation.rb:12:in
write'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/deprecation.rb:12:in
puts'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/deprecation.rb:12
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/deprecation.rb:23:in
call'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/deprecation.rb:23:in
warn'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/helpers/url_helper.rb:331:in
convert_options_to_javascript!'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/helpers/url_helper.rb:69:in
link_to'
#{RAILS_ROOT}/app/views/users/list.rhtml:19:in
_run_rhtml_47app47views47users47list46rhtml'
#{RAILS_ROOT}/app/views/users/list.rhtml:8:in each'
#{RAILS_ROOT}/app/views/users/list.rhtml:8:in
_run_rhtml_47app47views47users47list46rhtml'

Please ask if you want the full trace, since it's more space to waste on

The services are: "c:/ruby/bin/mongrel_service.exe" single -e production
-p 4001 -a 0.0.0.0 -l "log/mongrel.log" -P "log/mongrel.pid" -c
"C:/boxback" -t 0 -r "public" -n 1024

C:/boxback is my application root.

A precise explanation of how things happen is:  Webrick OR mongrel as a
non-service, everything's fine.
With mongrel as a service under lighttpd proxied to IIS with ISAPI
Rewrite and using the Reverse Proxy plugin, when I am -linked- by a
redirect from a create/edit/destroy scaffolding, I get the crash.

More relevant info:
The same happens if I use paginate or @regions = Region.find(:all)

The region file text is:
<% for region in @regions %>
<tr>
<% for column in Region.content_columns %>
<td>
<% if column.name == "logo_url" %>
<br><img src="<%=h region.send(column.name) %>" width=30% /><br>
<% end %>
<%= simple_format region.send(column.name) %>
</td>
<% end %>
<td><%= link_to 'Show', :action => 'show', :id => region %></td>
<td><%= link_to 'Edit', :action => 'edit', :id => region %></td>
<td><%= link_to 'Destroy', { :action => 'destroy', :id => region },
:confirm => 'Are you sure?', :post => true %></td>
-------ERROR POINTS TO THIS BLANK LINE HERE-------
</tr>
<% end %>

Finally, please note that this application was heavily tested and torn
apart by a small QA group before the migration into
IIS/lighttpd/mongrel.  I haven't a clue what's wrong.

Luis Lavena wrote:
> On 2/24/07, Fausto <dieffe@gmail.com> wrote:
>>
>> The Contatti class is properly defined in the model since i can access
>> it via both console and browser running mongrel not as service.
>> Do you suggest that the whitespace policy is different from the
>> service and non service version of mongrel?
>>
>
> Since services execute with a user account other than your (actually,
> the run using LocalService account). They cannot access a lot of
> things, these could be: directories, networked drives, etc.
>
> Often these problems are related to permissions. I file marked just
> for you will fail tried to access under a service, but this isn't the
> case.
>
> Without the backtrace, I cannot help you deep into the problem, since
> I cannot recreate here these conditions.
>
> Also, the command line used to start the service is very important, if
> you could access service manager (Start->Run...->services.msc) and
>
> Regards,
>
>
> --
> Luis Lavena
> Multimedia systems
> -
> which is the price which all of us must pay to achieve any goal that
> is worthwhile.
> Vince Lombardi
on 2007-02-26 17:31
Actually a correction to the above statement and a partial solution.

I hadn't rebooted all my services on exactly one test I did, so this is
the truth of it:

When I use the paginate command in the controller, I get the error
-EVERY- time I create/edit/delete.  It worked fine under heavy testing
before the migration.
When I replace it with @region = Regions.find(:all) and -really- reboot
all my mongrel services, it works perfectly.

It seems either SQL Server, Mongrel, ISAPI Rewrite, or the Reverse proxy
screws with some of the underlying code in paginate...I have no clue
why, but most of my problems were resolved by taking pagination out of
my app.

I really like pagination, though...suggestions appreciated.
on 2007-02-26 17:55
On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>
> Hi.
>
> I too am having the same symptoms:
>

Mmm, not the same, let me ask you a few things:

* What database backend are you using?
* Since the backend require native bindings (and also some dll). Are
these dlls (sqlite3.dll or libmysql.dll) available system wide? (try
putting them into windows\system32).
* if plain mongrel_rails start ... works, then you could try:

mongrel_service console single "all the parameters you use with your
service":

mongrel_service console single -e production -p 4001 -a 0.0.0.0 -l
"log/mongrel.log" -P "log/mongrel.pid" -c "C:/boxback" -t 0 -r
"public" -n 1024

* In case it works, now you need to get if your environment (and the
permissions) are good to run the service.

problems:

http://rubyforge.org/pipermail/mongrel-users/2007-...

Using psexec -l cmd.exe you get a restricted console, try running
mongrel_rails in it and check the console for errors.

> Finally, please note that this application was heavily tested and torn
> apart by a small QA group before the migration into
> IIS/lighttpd/mongrel.  I haven't a clue what's wrong.
>

Often is not a problem of test, but permissions of NTFS filesystem or
bugs in the Ruby VM and implementation under windows, who will guess
that?

Anyway, a lot of these problems could be solved, like the one on the
list I make references previously.

Hope could get a solution for the "missing log" of mongrel_service in
the following days.

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-26 18:16
On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
> all my mongrel services, it works perfectly.
>
>

AFAIK, mongrel didn't mess with Rails, but there exist lot of cases
that thigns mess up... :-P

> It seems either SQL Server, Mongrel, ISAPI Rewrite, or the Reverse proxy
> screws with some of the underlying code in paginate...I have no clue
> why, but most of my problems were resolved by taking pagination out of
> my app.
>
> I really like pagination, though...suggestions appreciated.
>

Will Paginate?

http://errtheblog.com/post/929

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-26 18:25
Looking up, I'm still pretty sure it's the same problem, at least to the
root.  It's the exact same error, and more specifically, a refresh works
just fine.

1) The database backend is SQL Server.  This is required by the IT dept
here.  The bindings are system-wide.

2) I tried adding "console" before single, it didn't do anything

3) I tried psexec -l cmd.exe and running mongrel_rails.  It worked
perfectly and showed no errors.

RE: Permissions: I gave the folder full permissions for all users, and
it didn't help.

Worst of all, the error seems to be "sometimes" now that I disabled
pagination.  I -think- it might be a login-limit to the scheduler user
on the database.  I'm communicating with the DB Admin regarding that
now.  If it -is- that, the error could use to be more clear.  If it's
-not- that, then I'll still be stuck at square one.

Luis Lavena wrote:
> On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>>
>> Hi.
>>
>> I too am having the same symptoms:
>>
>
> Mmm, not the same, let me ask you a few things:
>
> * What database backend are you using?
> * Since the backend require native bindings (and also some dll). Are
> these dlls (sqlite3.dll or libmysql.dll) available system wide? (try
> putting them into windows\system32).
> * if plain mongrel_rails start ... works, then you could try:
>
> mongrel_service console single "all the parameters you use with your
> service":
>
> mongrel_service console single -e production -p 4001 -a 0.0.0.0 -l
> "log/mongrel.log" -P "log/mongrel.pid" -c "C:/boxback" -t 0 -r
> "public" -n 1024
>
>
> * In case it works, now you need to get if your environment (and the
> permissions) are good to run the service.
>
> problems:
>
> http://rubyforge.org/pipermail/mongrel-users/2007-...
>
> Using psexec -l cmd.exe you get a restricted console, try running
> mongrel_rails in it and check the console for errors.
>
>> Finally, please note that this application was heavily tested and torn
>> apart by a small QA group before the migration into
>> IIS/lighttpd/mongrel.  I haven't a clue what's wrong.
>>
>
> Often is not a problem of test, but permissions of NTFS filesystem or
> bugs in the Ruby VM and implementation under windows, who will guess
> that?
>
> Anyway, a lot of these problems could be solved, like the one on the
> list I make references previously.
>
> Hope could get a solution for the "missing log" of mongrel_service in
> the following days.
>
> --
> Luis Lavena
> Multimedia systems
> -
> which is the price which all of us must pay to achieve any goal that
> is worthwhile.
> Vince Lombardi
on 2007-02-26 18:34
On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>
> -not- that, then I'll still be stuck at square one.
>
>

Ok, post you progress on this subject or contact me off the list in
any case. Maybe you could provide more inside information and I could
recreate the scenario here to get into the issue.

Regards,

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-26 19:46
Please continue to post progress with this issue, we have something
similar with a page that works fine under WEBrick but has the same error
once in a while under IIS/mongrel.
on 2007-02-26 19:54
Garth Smedley wrote:
> Please continue to post progress with this issue, we have something
> similar with a page that works fine under WEBrick but has the same error
> once in a while under IIS/mongrel.

I'm still awaiting information from the DBA.  He doesn't seem to be in
today.  Once I took out pagination, and the other developer stopped
testing it with me, the error counts dropped to about 1 in 7 or 1 in 8,
with me having to push it with simultaneous connections.  Either
something is drastically wrong with mongrel's concurrency capabilities,
or something's up with SQL Server.  At this point, I'm pretty convinced
there's nothing in my code or NTFS permissions doing this.
on 2007-02-26 20:04
C.jay Martin wrote:
> Garth Smedley wrote:
>> Please continue to post progress with this issue, we have something
>> similar with a page that works fine under WEBrick but has the same error
>> once in a while under IIS/mongrel.
>
> I'm still awaiting information from the DBA.  He doesn't seem to be in
> today.  Once I took out pagination, and the other developer stopped
> testing it with me, the error counts dropped to about 1 in 7 or 1 in 8,
> with me having to push it with simultaneous connections.  Either
> something is drastically wrong with mongrel's concurrency capabilities,
> or something's up with SQL Server.  At this point, I'm pretty convinced
> there's nothing in my code or NTFS permissions doing this.

NTFS Permissions update:

Tossed the whole thing onto a test box, gave ruby, my app, mongrel, etc
full user permissions.  Still seems to happen.
on 2007-02-26 20:09
We just tried removing IIS & isapi rewrite and haven't been able to
reproduce the  problem since. This makes me wonder if it isn't some odd
interaction between IIS and Mongrel.
on 2007-02-26 20:09
On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
> > with me having to push it with simultaneous connections.  Either
> > something is drastically wrong with mongrel's concurrency capabilities,
> > or something's up with SQL Server.  At this point, I'm pretty convinced
> > there's nothing in my code or NTFS permissions doing this.
>
> NTFS Permissions update:
>
> Tossed the whole thing onto a test box, gave ruby, my app, mongrel, etc
> full user permissions.  Still seems to happen.
>

You still use the SQL Server as backend, right?

Could you try a clean rails app as service? put some test controller
(like hello world action).

If that don't fail, is related to our SQL Server connection that
timeout and raise some issues (randomly it seems).

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-26 20:47
Can't totally rule out Mongrel routing, because the test was so simple
and I was unable to enforce two simultaneous attempts, but the hello

Second-check.  I did the same exact thing with the login screen for the
real program (it doesn't link to the database..that's -IT- for
differences) and not one error.  It has to be DB related.

I think all that leaves is the DB, Rails' link to the database, or
Mongrel's treatment of the processes in regards to the DB.  It's
definitely related to the DB though.

Luis Lavena wrote:
> On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>> > with me having to push it with simultaneous connections.  Either
>> > something is drastically wrong with mongrel's concurrency capabilities,
>> > or something's up with SQL Server.  At this point, I'm pretty convinced
>> > there's nothing in my code or NTFS permissions doing this.
>>
>> NTFS Permissions update:
>>
>> Tossed the whole thing onto a test box, gave ruby, my app, mongrel, etc
>> full user permissions.  Still seems to happen.
>>
>
> You still use the SQL Server as backend, right?
>
> Could you try a clean rails app as service? put some test controller
> (like hello world action).
>
> If that don't fail, is related to our SQL Server connection that
> timeout and raise some issues (randomly it seems).
>
>
> --
> Luis Lavena
> Multimedia systems
> -
> which is the price which all of us must pay to achieve any goal that
> is worthwhile.
> Vince Lombardi
on 2007-02-26 21:04
DBA just got back to me.  The user logging in to the table has no
connection limit.  That means it has to be either the ADO.rb linking to
SQL Server, or Mongrel's handling of the database...Or unhandled
timeouts...

How would I go about making a timeout infinite, or handling one?
This is an enterprise grade Database on a server that doesn't get hit
hard... I really don't see why it'd be timeouts, honestly...but I'll
keep the possibility in mind.

C.jay Martin wrote:
> Can't totally rule out Mongrel routing, because the test was so simple
> and I was unable to enforce two simultaneous attempts, but the hello
>
> Second-check.  I did the same exact thing with the login screen for the
> real program (it doesn't link to the database..that's -IT- for
> differences) and not one error.  It has to be DB related.
>
> I think all that leaves is the DB, Rails' link to the database, or
> Mongrel's treatment of the processes in regards to the DB.  It's
> definitely related to the DB though.
>
>
>
> Luis Lavena wrote:
>> On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>>> > with me having to push it with simultaneous connections.  Either
>>> > something is drastically wrong with mongrel's concurrency capabilities,
>>> > or something's up with SQL Server.  At this point, I'm pretty convinced
>>> > there's nothing in my code or NTFS permissions doing this.
>>>
>>> NTFS Permissions update:
>>>
>>> Tossed the whole thing onto a test box, gave ruby, my app, mongrel, etc
>>> full user permissions.  Still seems to happen.
>>>
>>
>> You still use the SQL Server as backend, right?
>>
>> Could you try a clean rails app as service? put some test controller
>> (like hello world action).
>>
>> If that don't fail, is related to our SQL Server connection that
>> timeout and raise some issues (randomly it seems).
>>
>>
>> --
>> Luis Lavena
>> Multimedia systems
>> -
>> which is the price which all of us must pay to achieve any goal that
>> is worthwhile.
>> Vince Lombardi
on 2007-02-26 21:31
Here comes more useful info.

me about a 1 in 7 or 8 (same amount) of popping up with an error 500.
It makes very little sense to me because I know lighttpd routed properly
(had it not, I'd never have seen a rails error).

Confusion still there...

Hmm...I ran another stress run (20 pages at once) and the login screen
gave me a 500 error once as well... Something's up...I don't think one
mongrel can handle 20 connections, but since the failure rate goes -way-
up when I have a database involved, I'm uncertain...

C.jay Martin wrote:
> Can't totally rule out Mongrel routing, because the test was so simple
> and I was unable to enforce two simultaneous attempts, but the hello
>
> Second-check.  I did the same exact thing with the login screen for the
> real program (it doesn't link to the database..that's -IT- for
> differences) and not one error.  It has to be DB related.
>
> I think all that leaves is the DB, Rails' link to the database, or
> Mongrel's treatment of the processes in regards to the DB.  It's
> definitely related to the DB though.
>
>
>
> Luis Lavena wrote:
>> On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>>> > with me having to push it with simultaneous connections.  Either
>>> > something is drastically wrong with mongrel's concurrency capabilities,
>>> > or something's up with SQL Server.  At this point, I'm pretty convinced
>>> > there's nothing in my code or NTFS permissions doing this.
>>>
>>> NTFS Permissions update:
>>>
>>> Tossed the whole thing onto a test box, gave ruby, my app, mongrel, etc
>>> full user permissions.  Still seems to happen.
>>>
>>
>> You still use the SQL Server as backend, right?
>>
>> Could you try a clean rails app as service? put some test controller
>> (like hello world action).
>>
>> If that don't fail, is related to our SQL Server connection that
>> timeout and raise some issues (randomly it seems).
>>
>>
>> --
>> Luis Lavena
>> Multimedia systems
>> -
>> which is the price which all of us must pay to achieve any goal that
>> is worthwhile.
>> Vince Lombardi
on 2007-02-26 23:38
On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>
> DBA just got back to me.  The user logging in to the table has no
> connection limit.  That means it has to be either the ADO.rb linking to
> SQL Server, or Mongrel's handling of the database...Or unhandled
> timeouts...
>

Most usual are unhandled timeouts. Mongrel CAN serve 20+ request, but
not with Rails, since isn't Thread-Safe and require a big lock around
it to avoid random and madness due ActiveRecord:

http://mongrel.rubyforge.org/docs/frameworks.html

Also pointed in the FAQs:

http://mongrel.rubyforge.org/faq.html

> How would I go about making a timeout infinite, or handling one?
> This is an enterprise grade Database on a server that doesn't get hit
> hard... I really don't see why it'd be timeouts, honestly...but I'll
> keep the possibility in mind.
>

Previously you was serving your rails applications with lighttpd and
fastcgi, right? That means a bunch of ruby process to "balance" the
load of every request that get into lighty.

Since you're running one instance (as service), several hits to the
same instance will timeout, mostly due slow answers from DB (most of
the cases).

Could someone contribute more with SQL Server setups? I'm not a user
of them, could try to re-create Jays scenario but will take time.

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-27 14:41
Previously, it was Webrick for me... I expected to have access to apache
with fastcgi when I was developing the project... apparently only
certain purchased apps are allowed to use the apache server... so the
webserver guy gave me the admin pass to the webserver and said "get your
rails app working here".

I think I'm going to try lighttpd with fastcgi instead, honestly...
It'll mean another midnight, but if I can't get mongrel working..bleh

Luis Lavena wrote:
> On 2/26/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>>
>> DBA just got back to me.  The user logging in to the table has no
>> connection limit.  That means it has to be either the ADO.rb linking to
>> SQL Server, or Mongrel's handling of the database...Or unhandled
>> timeouts...
>>
>
> Most usual are unhandled timeouts. Mongrel CAN serve 20+ request, but
> not with Rails, since isn't Thread-Safe and require a big lock around
> it to avoid random and madness due ActiveRecord:
>
> http://mongrel.rubyforge.org/docs/frameworks.html
>
> Also pointed in the FAQs:
>
> http://mongrel.rubyforge.org/faq.html
>
>> How would I go about making a timeout infinite, or handling one?
>> This is an enterprise grade Database on a server that doesn't get hit
>> hard... I really don't see why it'd be timeouts, honestly...but I'll
>> keep the possibility in mind.
>>
>
> Previously you was serving your rails applications with lighttpd and
> fastcgi, right? That means a bunch of ruby process to "balance" the
> load of every request that get into lighty.
>
> Since you're running one instance (as service), several hits to the
> same instance will timeout, mostly due slow answers from DB (most of
> the cases).
>
> Could someone contribute more with SQL Server setups? I'm not a user
> of them, could try to re-create Jays scenario but will take time.
>
> --
> Luis Lavena
> Multimedia systems
> -
> which is the price which all of us must pay to achieve any goal that
> is worthwhile.
> Vince Lombardi
on 2007-02-27 16:25
On 2/27/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>
> Previously, it was Webrick for me... I expected to have access to apache
> with fastcgi when I was developing the project... apparently only
> certain purchased apps are allowed to use the apache server... so the
> webserver guy gave me the admin pass to the webserver and said "get your
> rails app working here".
>
> I think I'm going to try lighttpd with fastcgi instead, honestly...
> It'll mean another midnight, but if I can't get mongrel working..bleh
>

I don't know how SQL Server from *nix will for for you, but deploying
isn't a thing so simple that "you drop a file here and you're ready to
roll".

It requires a lot of thinking and often a re-thinking based on the
initial results. Often it takes me 3 rounds to get a good deployment
environment, without counting DB communication issues.

Guess Zed will agree with me on this: If your company is "constrained"
to windows environment (that includes IIS), you should find a
workaround... hey, you could even add pen [1] to the equation and do
some load balancing to a bunch of mongrel via ISAPI rewrite:

IIS -> ISAPI rewrite -> Pen (cygwin) -> Bunch of Mongrels.

If your decisions have height at your company, use a scenario that
makes you feel better, nothing stops you, all we want is that you be
happy :-)

Your questions are welcome, but ignoring issues regarding DB<->App
communication (I guess since you're running just one instance of your
application) isn't right.

There are things inherent to each solution that you must know (or at
least try), even if you coded your app in a "magical" framework like
rails.

I'm here to contribute and help the community, so feel free to ask :-)

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-02-28 19:03
Eh..I had to rewrite all the Rails sql statements on the swap, but
otherwise, SQL was fine till I swapped to mongrel as a service.

My opinions/decisions bear very little weight upon IT, sadly, but any
solution I can confirm and prove, will probably be accepted if I spin it
as "still using only one system as a webserver"... long story...I think
I'm going to try to use lighttpd with fastcgi instead... we'll see what
happens

Luis Lavena wrote:
> On 2/27/07, C.jay Martin <ruby-forum-incoming@andreas-s.net> wrote:
>>
>> Previously, it was Webrick for me... I expected to have access to apache
>> with fastcgi when I was developing the project... apparently only
>> certain purchased apps are allowed to use the apache server... so the
>> webserver guy gave me the admin pass to the webserver and said "get your
>> rails app working here".
>>
>> I think I'm going to try lighttpd with fastcgi instead, honestly...
>> It'll mean another midnight, but if I can't get mongrel working..bleh
>>
>
> I don't know how SQL Server from *nix will for for you, but deploying
> isn't a thing so simple that "you drop a file here and you're ready to
> roll".
>
> It requires a lot of thinking and often a re-thinking based on the
> initial results. Often it takes me 3 rounds to get a good deployment
> environment, without counting DB communication issues.
>
> Guess Zed will agree with me on this: If your company is "constrained"
> to windows environment (that includes IIS), you should find a
> workaround... hey, you could even add pen [1] to the equation and do
> some load balancing to a bunch of mongrel via ISAPI rewrite:
>
> IIS -> ISAPI rewrite -> Pen (cygwin) -> Bunch of Mongrels.
>
> If your decisions have height at your company, use a scenario that
> makes you feel better, nothing stops you, all we want is that you be
> happy :-)
>
> Your questions are welcome, but ignoring issues regarding DB<->App
> communication (I guess since you're running just one instance of your
> application) isn't right.
>
> There are things inherent to each solution that you must know (or at
> least try), even if you coded your app in a "magical" framework like
> rails.
>
> I'm here to contribute and help the community, so feel free to ask :-)
>
> --
> Luis Lavena
> Multimedia systems
> -
> which is the price which all of us must pay to achieve any goal that
> is worthwhile.
> Vince Lombardi
on 2007-02-28 19:13
Sorry, forgot to log in.  That last message was me
on 2007-04-10 18:34
I had a similar problem using Mongrel as a service. Application worked
fine when run from the command line, but stopped working when I switched
it over to a service. Below is the error I was receiving:

Processing DesignController#entity_operations (for 10.5.5.34 at
2007-04-10 11:12:25) [POST]
Session ID: 2a296cf41d598819d3271119c7ef2c74
Parameters: {"action"=>"entity_operations", "id"=>"34",
"controller"=>"design", "sort"=>"name"}

Errno::EINVAL (Invalid argument):
/app/models/operation.rb:166:in write'

The next time I attempted to call the "entity_operations" method I would
get a totally different error which was:

c:/web/cincom_design/config/../app/models/operation.rb to define
Operation):
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in
const_missing'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
const_missing'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:in
constantize'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
constantize'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/pagination.rb:195:in
paginator_and_collection_for'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/pagination.rb:130:in
paginate'
/app/controllers/design_controller.rb:351:in entity_operations'

It has taken me several hours to resolve this, but finally figured out
that this error was being caused by a "space" in the model file between
a method name and the left "(" of the parameter listing. Specifically, I
was using a Builder::XmlMarkup variable calling the "Row" and "Cell"
methods as shown below:

xml = Builder::XmlMarkup.new
xml.Row ("ss:Height" => "64.5", "ss:StyleID" => "s23") {
xml.Cell ("ss:StyleID" => "s22") {
xml.Data("Entity Name", "ss:Type" => "String")
}

As soon as I removed all the spaces between the method and parameter
list, the application began to work.

Don't know if this helps anyone else, but I thought it may be useful to
someone.

Kevin
on 2007-04-10 22:25
On 4/10/07, Kevin Ansberry <ruby-forum-incoming@andreas-s.net> wrote:
>
>
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
> paginator_and_collection_for'
>     xml = Builder::XmlMarkup.new
>
Kevin,

What you describe sounds like a pre-0.3.1 version of mongrel_service.

Also, write operations (since guess you're creating a file) will be
affected by Access Control List on Windows (most of the times known as
Permissions and LUA bugs).

Anyway, space issues are odd, but found since started with ruby on
windows that tabs, carrier returns (\r) and new lines (\n) in models,
controllers and worse on views produce a lot of weirdness around your
applications (and most of the times impossible to trace or debug).

--
Luis Lavena
Multimedia systems
-
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
on 2007-04-11 01:10
Yeah..final update.. I nixed Mongrel and used apache/fcgi, everything
works perfectly, and significantly faster than 4 mongrel processes (the
number I found worked fastest in the first place)

Luis Lavena wrote:
> On 4/10/07, Kevin Ansberry <ruby-forum-incoming@andreas-s.net> wrote:
>>
>>
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
>> paginator_and_collection_for'
>>     xml = Builder::XmlMarkup.new
>>
> Kevin,
>
> What you describe sounds like a pre-0.3.1 version of mongrel_service.
>
> Also, write operations (since guess you're creating a file) will be
> affected by Access Control List on Windows (most of the times known as
> Permissions and LUA bugs).
>
>
> Anyway, space issues are odd, but found since started with ruby on
> windows that tabs, carrier returns (\r) and new lines (\n) in models,
> controllers and worse on views produce a lot of weirdness around your
> applications (and most of the times impossible to trace or debug).
>
> --
> Luis Lavena
> Multimedia systems
> -
> Vince Lombardi