Juggernaut hangs? Workaround?

Hi guys

I am using Juggernaut to broker a multi party chat service. For some
reason it seems to hang often. I have isolated the hangs to the
following line of code:

def isloggedin?
return !Juggernaut.show_client(self.id).nil?
end

where self.id is the id of the user that needs to be pushed to. When it
hangs like this I have to restart the Juggernaut server and then the web
server seems to snap out of it. But then the Firefox clients crash and
the other browsers also throw up an error. (The latter is not my problem
for the moment)

I have searched the web far and wide and cannot find any reference to
other people experiencing similar problems, so I must assume its
something to do with my setup (running Ruby 1.8.6 and Rails 2.3.4 in
development mode on Windows XP with Mongrel as webserver and sqlite as
database)

Would it be possible to somehow trap this error - ie give it .5 seconds
to respond and if it doesnt to break out? At first I thought a simple
loop with a sleep instruction would do the trick. But obviously not -
the show_client function hangs altogether, so the interpreter never even
gets to the sleep instruction.

Please assist! I am at a loss.

ok - have done some more research and I can now duplicate the problem.

if I run

(0…1000).each {|i| Juggernaut.show_clients ; puts i }

from a fresh Juggernaut restart it crashes after 130 iterations.
Everytime. We tried it on a Mac and it doesn’t happen. It seems to run
out of ports or connections or something like that? Even putting a

sleep 1

in the loop doesnt make a difference - for some reason the connections
dont get flushed.

When it hangs my computer sits at 90% cpu usage.

Any ideas? anyone?

On 26 May 2010, at 12:54, Pieter H. wrote:

sleep 1

in the loop doesnt make a difference - for some reason the connections
dont get flushed.

When it hangs my computer sits at 90% cpu usage.

Any ideas? anyone?

Could this be related to running an old version of Juggernaut?

http://groups.google.com/group/Juggernaut-for-Rails/browse_thread/thread/e6ead2f9d9a10f6d?pli=1

I don’t even see that show_clients method in the latest source at

anymore.

Best regards

Peter De Berdt

Peter De Berdt wrote:

Could this be related to running an old version of Juggernaut?

Hi Peter

Thanks for the suggestion. Looked into it. I am running Juggernaut 0.5.8
on both the Vista and Mac machines. On Vista the loop freezes after 130
iterations. On mac it didnt freeze after 10 000.

So I tried it on my older installation - Windows XP, Juggernaut 0.5.7.
Here it runs smoothly up to 1516 iterations and then throws an error -
Errno: ECONNREFUSED: No connection could be made because the target
machine actively refused it.

At least its a trapable error!. If I get an error back instead of a
freeze I can work around it without having to reset the juggernaut
server.

So here it gets more interesting. After the error occurs it seems even a
single Juggernaut.show_clients gets me the error. And windows never
recovers! Even after waiting 10 minutes. I keep on getting the error (on
XP - with Vista I couldnt even get to this point as it just freezes)

So we tried it on the Mac. Seems better - runs up to 16000 connections
before it crashes. After a few minutes its well again - so it seems that
the connections do get flushed and made available to Juggernaut.

I dont know much about sockets and connections etc - any advice would
help - we eventually would want to host our solution on any platform -
which is why we went with Ruby on Rails.