Forum: Ruby on Rails FTP hangs Rails!

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.
225614451dc9aee33be11e0f6876c18b?d=identicon&s=25 Raymond Brigleb (Guest)
on 2006-03-22 20:37
(Received via mailing list)
Hi! I'm running a Rails app on Apache/FCGI, with a single handler
process on the server.

At one point my application needs to FTP a bunch of files to a remote
server. When it starts doing this, the server apparently freezes and
doesn't allow anyone else to do anything. Plus, after about twenty
seconds, my nice status page vanishes from the browser, even though
the FTP'ing is continuing on the server!

Is there an easy fix for this, or have I run into a bigger problem here?

Thanks,
Raymond
6372e690497a80453a1d3d120d8b8818?d=identicon&s=25 Jason Stewart (Guest)
on 2006-03-24 14:55
(Received via mailing list)
On 22/03/06 11:36 -0800, Raymond Brigleb wrote:
>
> Thanks,
> Raymond

Hi Raymond,

That doesn't seem like a rails problem. More of an OS or FTP daemon
problem. What do the resource stats on your machine look like when
you're FTP'ing the files?

Regards,
Jason
B84d42a3a5c343f8fc6ab7d7f47fd3f5?d=identicon&s=25 Robby Russell (Guest)
on 2006-03-24 16:52
(Received via mailing list)
On Wed, 2006-03-22 at 11:36 -0800, Raymond Brigleb wrote:
>
There could be a memory leak somewhere that causes this. It's hard to
say without some more specific information about the tasks being
performed and the logs that are being generated.

-Robby

--
/**************************************************************
* Robby Russell, Founder & Executive Director                 *
* PLANET ARGON, LLC | www.planetargon.com                     *
* Ruby on Rails Development, Consulting, and Hosting          *
* Portland, Oregon  | p: 503.351.4730 | f: 815.642.4068       *
* blog: www.robbyonrails.com | book: www.programmingrails.com *
***************************************************************/
65c04c5dc6aa662abdd70275b024dbcc?d=identicon&s=25 Raymond Brigleb (Guest)
on 2006-03-24 19:51
(Received via mailing list)
Thanks Jason and Robby for your responses!

What was happening was this. Using Apache and apparently a single FCGI
process. Which seems weird in and of itself. This is on a shared host
which already had some glitches to be ironed out before Rails would
even work. Running a shared host serving Rails apps must be one of the
hardest jobs in the world, for real!

Anyhow, there's this ftp routine that copies a bunch of files, and the
HTML page that's rendered beforehand just shows a spinner kinda thing.
After all the files get copied, you're redirected to the home page.
This works fine for me on Lighttpd, Webrick, and Apache also on my OSX
box. But on the server, everything freezes while FTP is taking place.
Literally, no-one else can use the system. Plus, the web browser
decides to crap out after about 15 seconds or less, throwing a blank
page or a network error!

For now I just moved the app back to TextDrive, since the problem was
not exhibited there. However, TextDrive is running lighttpd with four
fcgi processes, so I'm not sure if the fifth user to try this FTP
thing would be locked out or what. It's weird. Moving to TextDrive has
spawned other problems however, such as a memory ceiling that nearly
every RMagick call hits. Oops!

So this is just to clear it up... If you're running an app with any
kind of serious needs, Apache/FCGI is really inadequate. This has
surely been said many times before! Furthermore, shared hosts have
their own host of problems, no matter what. Lighttpd solves most of
them, in my experience, but some remain. For example, the RMagick
problem I may be able to solve by moving to MiniMagick but haven't
gotten there yet. We shall see.

In conclusion, I would *love* to see someone come up with a real
dedicated Rails hosting system. It will be tough but I think you could
charge a bit more for it, provided many of these kinks were ironed
out. I know TextDrive is trying to do this, but whoever does it first
deserves to make a good living!

As an aside, I hear the brilliant Pragmatic Programmers are coming out
with a book specific to Rails deployment. Is this true? Or is it just
a rumor? If it's true, I'm the first in line!

Cheers and thanks again,
Raymond
90a73d9875462aaa9fab2feffafbffe7?d=identicon&s=25 Ben Bleything (Guest)
on 2006-03-24 19:59
(Received via mailing list)
On Fri, Mar 24, 2006, Raymond Brigleb wrote:
> Thanks Jason and Robby for your responses!
>
> What was happening was this. Using Apache and apparently a single FCGI
> process. Which seems weird in and of itself. This is on a shared host
> which already had some glitches to be ironed out before Rails would
> even work. Running a shared host serving Rails apps must be one of the
> hardest jobs in the world, for real!

I think you can tune the number of processes it starts, but I'm not sure
how.

> Anyhow, there's this ftp routine that copies a bunch of files, and the
> HTML page that's rendered beforehand just shows a spinner kinda thing.
> After all the files get copied, you're redirected to the home page.
> This works fine for me on Lighttpd, Webrick, and Apache also on my OSX
> box. But on the server, everything freezes while FTP is taking place.
> Literally, no-one else can use the system. Plus, the web browser
> decides to crap out after about 15 seconds or less, throwing a blank
> page or a network error!

Were you spinning off a new thread (in ruby-land) to do the FTP?  If
not, perhaps you should try that and see if it fixes your problem.

Ben
A777f1a2049d78a12ead38efb8f75f97?d=identicon&s=25 Tanner Burson (Guest)
on 2006-03-24 23:41
(Received via mailing list)
On 3/24/06, Ben Bleything <ben@bleything.net> wrote:
> I think you can tune the number of processes it starts, but I'm not sure
>
> Were you spinning off a new thread (in ruby-land) to do the FTP?  If
> not, perhaps you should try that and see if it fixes your problem.


Don't waste your time spinning a new thread.  Ruby has green threads, so
they are per interpreter instance only.  You're best bet is to fork the
call
to FTP so that it is it's own process, this way you don't have to worry
about it aborting mid way, or hanging up an FCGI process.

Ben
This topic is locked and can not be replied to.