powered by Jive Software

[patch] Upgrading Openfire to use Jetty 7 Continuations

I’m from the Jetty development team, and we’re interested in helping upgrade the continuations in Openfire from jetty-6-style continuations to jetty-7-style continuations. One advantage of upgrading is that while jetty-6-style continuations were a Jetty-specific mechanism, the jetty-7-style continuations are portable and work with a variety of containers. This means that they’ll work asynchronously with Jetty 6/7/8 and any servlet-3.0 containers. They’re also still compatible with servlet-2.5 containers, where they’ll be blocking.

We’ve had a few API changes, so switching versions requires a bit more than just dropping in updated JAR, but it’s not an extreme change, either. I have three patches:

  1. openfire.jetty6.patch
  • converts the continuations, with the addition of a filter to make the new-style continuations work with Jetty 6
  • keep the existing jetty-6 JARs
  • requires one new JAR file jetty-continuations.jar (direct download link)
  1. openfire.upgrade.jetty7.patch
  • upgrades jetty-6 to jetty-7
  • requires a few new JAR files, all noted in the diff for the versions.txt, and downloadable as JARs
  1. openfire.continuations.jetty7.patch
  • converts the continuations

The *.jetty7.patch patches need to be combined for the project to compile; I’ve separated them out this way to make it easier to determine what was changed, and why.

Thanks for your work. I’ve added the OF-46 ticket for tracking the upgrade.

Thanks!

I’ll keep an eye on that issue, if there’s anything further I can do to help.

Awesome, thanks for doing this. One quick thing, you might want to update the logger in AdminConsolePlugin to:

System.setProperty("org.eclipse.jetty.util.log.class", "org.jivesoftware.util.log.util.JettyLog");

Otherwise, the jetty logging will appear in nohup.out

Thanks for the tip, BenV.

Here’s a second version of the jetty-7 upgrade patch.

Also, I ran into some trouble applying my own patches back to my code for testing – the line endings may have been messed up when I opened them in an editor to look at, so I’m reuploading the first two patches as well, in clean form, to be safe.
openfire.upgrade.jetty7.take2.patch.zip (1816 Bytes)
openfire.continuations.patch.zip (1422 Bytes)
openfire.jetty6.patch.zip (1909 Bytes)

Firstly, thanks for providing these patches.

I have updated Openfire to the latest RC version of Jetty 7 using the patches provided above. It was a little bit painful but came together in the end.

The reason I am trying the update is to resolve the issue in threads:

Hopefully this will fix this issue as this update seems to make major updates to the continuations. So far soo good.

If anyone else needs help making this update let me know.

Daniel

Glad these worked for you! Which were the most painful parts, if I may know? Anything I can fix to help with?

The good news is that this version has stopped the Continuation errors and so the CPU isn’t jumping up anymore.

When I copied all the java libraries into the Openfire merge I got a bunch of strange security errors and it wouldn’t compile.

Then I had ongoing issues trying to compile. Eventually by identifying exactly which java libraries were required it worked, but it took a lot of going backwards and forwards to work this out. Sorry I don’t have the details at hand at the moment.

I also had some issues with functions that were missing in derived classes. This was easily fixed though but they should be put into your patch. Again I can’t remember which class it was at the moment and I don’t have access to the system.

If helpful, I will try and get the details across to you when I get back in the office.

Thanks

Oh these are all the libraries I had to copy across into the build/lib/merge folder after deleting the original Jetty files.

jetty-util-7.0.0.RC6.jar

jetty-webapp-7.0.0.RC6.jar

jetty-continuation-7.0.0.RC6.jar

jetty-http-7.0.0.RC6.jar

jetty-server-7.0.0.RC6.jar

jetty-servlet-7.0.0.RC6.jar

(If I copied the whole lot across I couldn’t compile - this may be an issue with that particular RC)

I’ve actually been doing quite a bit of work to refactor the Openfire BOSH implementation since every time we try to use it in production it brings our server down rather quickly. The Jetty7 continuation patch by itself didn’t seem to help much.

This weekend I cleaned up the implementation quite a bit, including switching from the “undispatch” method to using continuation listeners, which allowed me to simplify the code a ton. I have done this for both Openfire and the connection manager module. I’m doing some more testing on this stuff, but I’ll come back and update you all with my results, and post the code if it all works out!

Curiously - How many people do you have online using BOSH when it is failing? We average about 1000-2000 people on BOSH and about 5000+ using socket at any time. They are connecting using a modified XIFF client. Since we applied the above patch our Openfire server has been a lot more stable.

During the week we have about 25,000 concurrent users, and on weekends 33k-35k. I think one of the main differences that we have is our users are all using MUC, with ~200-250 users per room. I’m wondering if that is aggrivating things. It doesn’t seem to make much of a difference how many users are connected with BOSH, we have had problems with as few as 200

Hi Ben,

Do you have any updated patches that you can share? It’d be great if we could benefit from your hard work.

Regards,

Guus

I have been trying to apply Jetty 7.0.1 release but unfortunately not having much luck.

I had no problem before with the RC versions.

The project compiles ok and Openfire starts to run, but the admin console never launches - which is the first thing that uses Jetty.

There are no errors at all.

Has anyone else tried to update to recent versions of Jetty?

Thanks

Daniel

I managed to resolve this issue. The required libraries to be merged are:

jetty-continuation-7.0.1.v20091125.jar

jetty-http-7.0.1.v20091125.jar

jetty-io-7.0.1.v20091125.jar

jetty-security-7.0.1.v20091125.jar

jetty-server-7.0.1.v20091125.jar

jetty-servlet-7.0.1.v20091125.jar

jetty-util-7.0.1.v20091125.jar

jetty-webapp-7.0.1.v20091125.jar

jetty-xml-7.0.1.v20091125.jar

Or a later version.

You also need to do some minor work in JettyLog.java to correctly implement the Logger interface after applying the two patches in the related issue.

openfire.continuations.patch

openfire.upgrade.jetty7.take2.patch

Hopefully this issue can be updated in the Openfire trunk soon.

Thanks

Daniel

Message was edited by: StaticVortex - missed jetty-xml-7.0.1.v20091125.jar

I’ve updated the trunk version to the latest stable Jetty 7 (7.0.1.v20091125).

Excellent!

Are you also going to be updating the MINA libraries to 1.1.7 ?

This helped some issues for us. There are a few minor code changes to do this but I am happy to clearly document it in a new thread if that is helpful.

Although its covered in other discussions it’s all very scattered.

Thanks

Daniel

Daniel,

Yes please. A patch against current trunk would be very much appreciated.

daryl

PS. Do you have interest to help more directly with openfire development (ie svn access)?

Please note that Openfire does not use the “standard” Mina 1.1.7 due to a bug that affects Openfire. Gato has used a fork of Mina 1.1.7 for OF lately. The patch and bug is documented here: http://www.igniterealtime.org/issues/browse/JM-1115.

Any update of MINA may want to check, if the patch is included in the latest MINA. AFAIK the patch was submitted to the MINA project by Gato, but I do not know the result of that.

Walter

P.S. The original report/patch is here: http://www.igniterealtime.org/community/message/180622#180622