Monday, April 21, 2008

spawn plugin - now works with nginx

The latest version (0.6) of the spawn plugin for rails, now works with nginx. Go get it... now!

6 comments:

eugene said...

Tom, first of all: thanks for spawn! I've been building a Facebook app, and being able to run the (very slow) API calls in the background has made all the difference in my app's responsiveness!

If you're not too busy, I have two questions for you:

1.) I've been using spawn with nginx for almost four months now, and as far as I can tell, everything's been running smooth -- is there any reason why the old version wouldn't have run with nginx?

2.) I installed 0.7 on my dev box, and it seems like every third request to my app results in a "Mysql::Error: Lost connection to MySQL server during query" error.

I see a couple of these errors per day, on my production box, and I wonder if the problem is related.

Any ideas? I'll be digging into the code, and I'll let you know what I find -- thanks again for spawn!

-Eugene

Tom said...

First make sure you get 0.7.1 ... I don't think it'll fix your problem but it fixes a minor problem when disconnecting from the listening socket.

Many nginx users reported problems with earlier versions of spawn. Spawn would run but browsers wouldn't appear to respond until the background job finished. I narrowed that particular problem down to the child process not disconnecting from the listening socket and the way nginx works, using HTTP/1.0 to proxy to mongrel, it wouldn't return until the child finished.

The way spawn reconnects to the database really hasn't changed since the earlier versions. I'm now disconnecting from the HTTP request sockets but that shouldn't have anything to do with database connections. Do you know if that error is coming from the parent or child process? I assume you're using the (default) forking?

Feel free to email me at the email address in the README file and I'll do what I can to help figure out your problem.

eugene said...

Doh! I just realized the problem I was having with 0.7.1 is that I left a copy of old version in my plugins folder, and the two were interfering.

Everything looks super now, thanks for the fast response!

-Eugene

Sidu said...

Thanks for the good stuff with Spawn - we've just started using it and it works like a charm.

Tom said...

Glad it's working well for you Sidu.

Eugene said...

(this is different Eugene)
hope this is not the worst place to post questions. I am trying to use spawn with thin, but getting a zombie for each spawned process... Any ideas?