High CPU on Openfire - please help

We have a site which uses the latest version of Openfire. (Although the problem has been occuring for some time)

Unfortunately at random intervals (after 1-12 hours after a service restart) the server CPU jumps up to 80% or so, then up to 100% and then Openfire stops working correctly.

On average there are between 1 and 30 people connected at any one time, and generaly this brings the CPU to about 1% unless the issue above takes place.

The CPU jumps up suddenly. It isn’t gradual. The only solution is to restart the Openfire service - the CPU doesn’t drop otherwise.

We have both direct connections and HTTP bind connections to the server.

There are no errors in the error logs at all.

In the warning logs we get:

2007.10.10 11:35:13 Packets could not be found for session 6e7f5208 cannotbe delivered to client

2007.10.10 11:35:31 Error for /http-bind/

java.lang.InternalError: Could not locate connection: 411438

at org.jivesoftware.openfire.http.HttpSession.getResponse(HttpSession.java:377)

at org.jivesoftware.openfire.http.HttpBindServlet.handleSessionRequest(HttpBindSer vlet.java:242)

at org.jivesoftware.openfire.http.HttpBindServlet.parseDocument(HttpBindServlet.ja va:148)

at org.jivesoftware.openfire.http.HttpBindServlet.doPost(HttpBindServlet.java:118)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)

at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)

at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollect ion.java:146)

at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)

at org.mortbay.jetty.Server.handle(Server.java:285)

at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)

at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765 )

at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:627)

at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)

at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)

at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)

at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)

I assume this is caused by disconnects which you would expect sometimes on a bind connection.

Could this be crashing openfire so badly or could it be something else?

Thanks.

Daniel

Hey Daniel,

The next time you see this problem could you get a few thread dumps of the server? To get a thread dump (in linux/solaris) you can execute kill -3 [process id] and the information will be stored in your stdout. Please remember to get 2 or 3 thread dumps with a few seconds between them. You can post the information here so we can analyze it.

Regards,

– Gato

We are actually running on Windows - do you know an easy way to do it on windows?

Thanks

Daniel

Hey Daniel,

There are a few ways to obtain a thread dump when running as a Windows service. If you are using Java 6 you can use jstack to create a thread dump. You will first need to execute jps to obtain the process id and then pass it as a parameter to jstack. You can also use this third party tool and finally you can read more about thread dumps in this nice blog.

Regards,

– Gato