Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361554

Summary: Session failover does not work on Jetty/OSGi
Product: [RT] Jetty Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: osgiAssignee: Jan Bartel <janb>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: d_a_carver, janb, jetty-inbox, ruediger.herrmann
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 353117    
Attachments:
Description Flags
Projects to reproduce the bug
none
Stacktrace
none
Projects to reproduce the bug none

Description Rüdiger Herrmann CLA 2011-10-20 10:53:11 EDT
Please note, I think this bug is related to bug 361110. Nonetheless I opened a separate bug as a) the comments on bug 361110 are already quite confusing and b) as opposed to embedding Jetty, this issue arises when using Jetty as is.

Now to the point:
I get a ClassNotFoundException after a (simulated) session failover. The set up is as follows:
There are two OSGi instances running in distinct VMs. Each instance runs Jetty 8.x and a RAP-based web application. A third VM runs an h2 database (on port 9999). The Jetty bundles are configured to use a JDBCSessionIdManager that connects to the h2 database. Apart from the worker name (node1 and node2) and the port (8080 and 9090), both instances are identical.

To reproduce, please import the attached three projects into your workspace. Setup your target platform as described in the attachment. Additionally you will need a software that can proxy or redirect request. I used a small tool called rinetd [1], which can be used to redirect ports.
Follow these steps:
1. launch h2, node1 and node2 with the respective launch configurations
2. setup rinetd to redirect from port 7070 to 8080
3. open a browser at http://localhost:7070/demo/rap
4. you should see a UI with a button called "push". Click the button several times. It shows a counter and the port number
5. stop rinetd and restart it to redirect from port 7070 to 9090
6. in the browser, click the "push" button again
-> in the console output of node2 you will see the exception

From comments on bug 361110 and bug 358557 I got the impression that this would work. Am I missing something? Or is there a mistake in the setup?

[1] http://www.boutell.com/rinetd
Comment 1 Rüdiger Herrmann CLA 2011-10-20 11:00:32 EDT
Created attachment 205639 [details]
Projects to reproduce the bug

For the projectsto compile and run, the following target components are necessary:
* Equinox OSGi 3.7.1 (only bundle org.eclipse.osgi and org.eclipse.osgi.services)
* H2 1.1 (available from Orbit)
* Jetty 8.x
* Servlet API 3.0 (either comes with Jetty or available from Orbit)
* RAP 1.5 > 2011-10-19 (only bundle org.eclipse.rap.rwt) available from http://eclipse.org/rap/downloads (RAP Runtime -> nightly build)

Please don't hesitate to email me and I will send you a zip of the above.
Comment 2 David Carver CLA 2011-10-20 11:19:14 EDT
Can you include the stack trace as well.
Comment 3 Rüdiger Herrmann CLA 2011-10-20 11:29:42 EDT
Created attachment 205643 [details]
Stacktrace

It looks like the subsequent JdbcSQLException is an aftereffect of the ClassNotFoundException
Comment 4 Rüdiger Herrmann CLA 2011-10-20 11:46:29 EDT
Created attachment 205649 [details]
Projects to reproduce the bug

One of the launch configs of the first attachment had a wrong auto-start setting for o.e.jetty.osgi.boot.
Everything else remains the same.
Please see the first attachment (attachment 205639 [details]) for the list of necessary target components.
Comment 5 Jan Bartel CLA 2012-04-27 00:09:11 EDT
Rüdiger,

If you create a session with node1, then stop and then restart it, and then hit it again from the browser, do you get the same ClassNotFoundException? In theory, this should be exactly the same situation as the node migration ...

Also please note that the latest jetty release is 8.1.3, so it may be worthwhile retesting with that.
Comment 6 Jan Bartel CLA 2012-04-27 00:12:30 EDT
(In reply to comment #5)

Also, I don't see an Import-Package statement for org.eclipse.rwt.internal.service in the manifest...

Jan


> Rüdiger,
> 
> If you create a session with node1, then stop and then restart it, and then hit
> it again from the browser, do you get the same ClassNotFoundException? In
> theory, this should be exactly the same situation as the node migration ...
> 
> Also please note that the latest jetty release is 8.1.3, so it may be
> worthwhile retesting with that.
Comment 7 Jan Bartel CLA 2012-05-04 05:00:41 EDT
Rüdiger,

I've tried using the HashSessionManager and persisting sessions across restarts. That is working fine (tested in virgo). This uses very similar mechanisms to the JDBC session persistence in terms of serializing and deserializing objects. In this case, the object was a simple one, and part of the webapp.

I can't seem to use the projects you attached to the issue. Also there was no explanatory file as you indicated in your post.

I think to get any further with this, you are going to need to turn up the debugging level for jetty, particularly for the org.eclipse.jetty.server.session.* package. 

Also, please try a much simpler case of using just the HashSessionManager with persistence (with a simple servlet that merely creates a session - you might like to use the test webapp that comes with jetty), and stopping and restarting - this will trigger the class reload.


thanks
Jan
Comment 8 Jan Bartel CLA 2013-08-25 23:14:49 EDT
Rüdiger,


Is there a status update on this bug? Do you have any comments in response to my last post (#7)? Have you made progress on using session reloading with/without osgi?

Jan
Comment 9 Jan Bartel CLA 2013-10-24 20:18:15 EDT
Rüdiger,

Its been a long time since I've heard from you with info about this bug. As I said a while ago, I wasn't able to reproduce the problem. So, I'm going to close this issue. If this is still a problem for you, please reopen with updated stack traces, test harness (and instructions on how to use the test harness), and instructions on how to reproduce the bug. Please do any testing against a recent jetty release, preferably jetty-9.1.x.

regards
Jan