PersistentManager in SunOne WebServer loosing variables?

Hi all!

I am using SunOne 6.1 sp5 .

I am trying to use the PersistentManager to store session the main reason :

I have to preserve session between server restarts.

The problem as it seems that some variables stored on the session object

are getting lost.The particular variable is used to track user log in ,so it is

pretty important :( .

I am not sure what code or config to post.

Here is a short description of the problem:

The applic. stores 3 variables in the session :

the user type,the part of the site the user logged in,the username.

All three are of String type.I have a HttpSessionAttributeListener that tracks it.

Every changes for all 3 variables recorded in the logs fine.However after

some navigation in the site the username is just gone without any

indications in logs and without the HttpSessionAttributeListener event fired .

The application is an MVC one so i have inserted some debug log into the

controller to print those 3 on every request ,I can see the username just

vanished while other 2 variables are still there.

To make it more interesting - if I use the "memory" (StandardManager) all

works fine.

The problem does not happens on any particular page and i am the only

user of this application that is still under development.

Again ,I am not sure what code or config to post.

I am kind of stuck here - the session persistence between restarts is a

must but it does not work.(already tried the StandartManager with

sessionFilename set but it does not help).

Please help.

[1661 byte] By [tsirkin] at [2007-11-26 8:49:34]
# 1

Hi there,

> I am not sure what code or config to post.

For starters, let's see the relevant sections of your sun-web.xml (particularly persistence-type).

> logs fine.However after

> some navigation in the site the username is just gone

> without any

> indications in logs and without the

> HttpSessionAttributeListener event fired .

What are the class types of these 3 attributes? J2SE classes or custom? If custom, how is username different than the other 2.

dev01@ws at 2007-7-6 22:39:16 > top of Java-index,Web & Directory Servers,Web Servers...
# 2

Thanks for the answer.

> For starters, let's see the relevant sections of your

> sun-web.xml (particularly persistence-type).

<session-manager persistence-type="file">

<manager-properties>

<property name="reapIntervalSeconds" value="20"></property>

</manager-properties>

<store-properties>

<property name="directory" value="/tmp/sessions"></property>

</store-properties>

</session-manager>

as a value of store-properties i have already tryed several things

including just "sessions" and other paths.(both relative and absolute)

> What are the class types of these 3 attributes? J2SE

> classes or custom?

Those are regular J2SE Strings.

> If custom, how is username

> different than the other 2.

That's exactly the point - it is not different in any way.

Evgeny.

tsirkin at 2007-7-6 22:39:16 > top of Java-index,Web & Directory Servers,Web Servers...
# 3

Hi Evgeny,

Is this summary of the problem correct?

- You have an app using "file" session persistence

- The app writes 3 String attributes to session

- After a few requests, one of the attributes vanishes

- This happens without restarting the instance

- The troubled attribute is always "username"

If this is correct then the bug is most likely in the logic of the app. A bug in file persistence would not just eat up username exclusively.

I suggest that you narrow down the vanishing act. i.e. insert getAttribute("username") at the beginning and end of every request to see when username goes away. Then examine the logic leading up to the request.

Can you provide a simple app to reproduce this bug? I can take a look and file a defect against WS as needed.

dev01@ws at 2007-7-6 22:39:16 > top of Java-index,Web & Directory Servers,Web Servers...
# 4

> Hi Evgeny,

>

> Is this summary of the problem correct?

> - You have an app using "file" session persistence

> - The app writes 3 String attributes to session

> - After a few requests, one of the attributes

> vanishes

> - This happens without restarting the instance

> - The troubled attribute is always "username"

>

Almost correct:

The "vanishing" of the attribute is inconsistent - it happens only in about

50% of cases .

> If this is correct then the bug is most likely in the

> logic of the app. A bug in file persistence would not

> just eat up username exclusively.

>

I was pretty sure this is the case,however as i already mentioned:

i have set up a HttpSessionAttributeListener to write a log about

what get inserted and what get deleted ,and the app. itself to write

to the same log what it has in the session.

Normally i am getting:

*************that is the application removing username from the session normally*************

[2006-07-17 19:25:19,698] DEBUG (HttpSessionAttributeListener.java:55) - In attributeRemoved the attribute username was removed from session value : 05061457

*************The controller notices this (only 2 element)

[2006-07-17 19:25:30,700] DEBUG (controller.java:144) - Processing request at controller

[2006-07-17 19:25:30,706] DEBUG (controller.java:158) - The session contains 2 elements

*************Here i really log what attributes are in session and the one missing is username************

However the problem is that there are cases that the log from HttpSessionAttributeListener is not there !And from controller is.

Which made me think that this is not my app. problem but the server's.

I tried very hard to find a problem in my application,really.

> I suggest that you narrow down the vanishing act.

> i.e. insert getAttribute("username") at the beginning

> and end of every request to see when username goes

> away. Then examine the logic leading up to the

> request.

>

I have already did but i will try harder.

> Can you provide a simple app to reproduce this bug? I

> can take a look and file a defect against WS as

> needed.

The application is pretty big ,reproducing is not a simple thing to do.

But i will try.

Just asking :

Since the session object itself is not synchronized is there a possibility

that while one request (thread) have session opened another tries to read

it from file and gets it partially?

Thanks.

tsirkin at 2007-7-6 22:39:16 > top of Java-index,Web & Directory Servers,Web Servers...