Rails crashes when running more than 1 instance..

Hello everyone,

I'm new here, and I wasn't sure where to put this question. So forgive me if this is the wrong place.

The problem I have is that when I open a second, different, rails app on one server, the ruby proces crashes. When I checkout the ruby process this is the loop it hangs in:

rt_sigprocmask(SIG_SETMASK, , NULL, 8) = 0 stat64("/tmp/passenger.18041", {st_mode=S_IFDIR|S_ISUID|0311, st_size=4096, ...}) = 0 open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 4 fstat64(4, {st_mode=S_IFREG|0644, st_size=512, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ab8000 read(4, "t\341\"\220\10\220\320\r\377k#O*9B\276D\217\7\243,8\332\36\320\342& \267\301K\315M"..., 4096) = 512 close(4) = 0 munmap(0xb7ab8000, 4096) = 0 socket(PF_FILE, SOCK_STREAM, 0) = 4 bind(4, {sa_family=AF_FILE, path="/tmp/passenger.18041/backends/ backend.dOEikAiQ0A3ayNPKjlCvkSPB6MsONoe0OImt8FLzU2vKpRCZcM20V1MRnTLP0WSgTMZMD"...}, 110) = -1 EADDRINUSE (Address already in use) close(4) = 0

I've searched google for "EADDRINUSE (Address already in use)" but I can't find a solution.. So I hope anyone has experienced this before, and solved it.. If you need some more information, please ask for it.

Thanks in advance!

Tim

Seriously? It means exactly what it says; one process is using the ip/port that the second one tried to bind to. That can't work.

Change one.

Hi Tim,

If you are using Fedora try following command in terminal:

console$> ps -fu

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND user 3429 0.0 0.0 5072 1672 pts/1 Ss Jun08 0:00 bash user 15217 2.0 0.0 4628 908 pts/1 R+ 03:17 0:00 \_ ps -fu user 3355 0.0 0.0 5072 1340 pts/0 Ss Jun08 0:00 bash user 3412 0.0 2.0 73600 42684 pts/0 Sl+ Jun08 0:20 \_ ruby script

console$> kill -9 3412 (PID for ruby script/server)

Might Help!

Saurabh

Hassan Schroeder wrote:

The problem I have is that when I open a second, different, rails app
on
one server, the ruby proces crashes.

I've searched google for "EADDRINUSE (Address already in use)" but I
can't find a solution..

Seriously? It means exactly what it says; one process is using the
ip/port that the second one tried to bind to. That can't work.
Change one.

Start one instance with ‘script/server -p 3004’ or something like that to make it use a different port. You then would access the app on the corresponding port.

Thank you all for the fast responds..

I can see now that the problem is I need to run the different applications on different ports.. The only thing is, I've heard it has to be possible to run more applications on one port, I want to use port 80. I'm using a webserver.. What are your ideas about this? Do you run all your web-applications on different ports?

Thanks, Tim

It looks like you're using passenger, you can certainly serve multiple apps from a single install of apache. It's easiest if you have separate virtual hosts but you can mount different rails apps at different paths (although it's a bit more involved)

Fred

Frederick Cheung wrote:

Thank you all for the fast responds..

I can see now that the problem is I need to run the different applications on different ports.. The only thing is, I've heard it has to be possible to run more applications on one port, I want to use port 80. I'm using a webserver.. What are your ideas about this? Do you run all your web-applications on different ports?

It looks like you're using passenger, you can certainly serve multiple apps from a single install of apache. It's easiest if you have separate virtual hosts but you can mount different rails apps at different paths (although it's a bit more involved)

Fred

I am using Ruby Enterprice Edition which includes passenger.. I am allready using seperate virtual hosts. Someone looked into that, and said the settings for that were good. Can the problem be because of DirectAdmin? Does anyone has experience with R.E.E. in combination with CentOS and DirectAdmin?

Many thanks for the help so far, I hope we can figure this out, it's really anoying, because I have to get the second application up and running..

Tim

Tim Baas wrote:

Thank you all for the fast responds..

I can see now that the problem is I need to run the different applications on different ports.. The only thing is, I've heard it has to be possible to run more applications on one port, I want to use port 80. I'm using a webserver.. What are your ideas about this? Do you run all your web-applications on different ports?

If you're using vhosts and Passenger, then just edit the Passenger config file appropriately (see the docs). You don't need to start the Rails server processes explicitly; Passenger takes care of that.

Thanks, Tim

Best,

Marnen Laibow-Koser wrote:

Tim Baas wrote:

Thank you all for the fast responds..

I can see now that the problem is I need to run the different applications on different ports.. The only thing is, I've heard it has to be possible to run more applications on one port, I want to use port 80. I'm using a webserver.. What are your ideas about this? Do you run all your web-applications on different ports?

If you're using vhosts and Passenger, then just edit the Passenger config file appropriately (see the docs). You don't need to start the Rails server processes explicitly; Passenger takes care of that.

Thanks, Tim

Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org

I've checked the settings.. But without any progress, I'll just try mongrel with Mongrel Cluster for now.. Let's see what that is going to do..

Tim Baas wrote: [...]

I've checked the settings.. But without any progress, I'll just try mongrel with Mongrel Cluster for now.. Let's see what that is going to do..

No! Get Passenger working -- it's far easier than Mongrel Cluster. Reread the docs -- it shouldn't be difficult. Under what circumstances are you getting the "Port already in use" error? What command do you type that causes it?

Best,

We've installed the whole thing again now.. Still the same error.. It's actually not when loading 2 different sites, but it happens if a site is clicked too many times.. We use 'webistrano' to upload our projects, and when we connect with two different browsers to it, and start clicking fast, rails gets in this loop, posted above..

We left it there for a while, but we still need to get it fixed.. So I hope someone passes by that had the same problem..