[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
New session created on every http request  XML
Forum Index -> Terracotta for Web Sessions Go to Page: 1, 2 Next 
Author Message
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline

We have configured terracotta 2.5.2 to cluster out tomcat (Embedded) servers.

We have clustered the session for the ROOT context and others. For the ROOT context every thing is working ok but for the other contexts a new session is being created on every http request (i can see in the TC console how the new session is created but in the following request that session is not reused). All the webapps are coded with the same framework (Apache OFBiz) so the code for processing the request for the ROOT context (that is working perfectly in cluster) is the same for the none working contexts.

Is there any issue about this situation.

Thanks!.
hgupta

jedi

Joined: 01/22/2008 10:44:02
Messages: 104
Offline

Hi,

Can you provide your tc-config.xml and your web.xml. It will help get an insight into the problem.

Also can you let me know what is the version of Tomcat and jdk you are using.

Thanks,

Himanshu Gupta,
Terracotta Inc.
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline

Hi.

I have attached the config files to the post.

The tomcat version we are using is Tomcat 6.0.16 with JDK1.6.05. We are using tomcat as an embedded app server.

How can i configure terracotta for DEBUG log level? Maybe i can get more data about what's happening.

Thanks a lot!!.

 Filename web.xml [Disk] Download
 Description Application web.xml. Is the same web.xml for all the webapps
 Filesize 4 Kbytes
 Downloaded:  584 time(s)

 Filename tc-config.xml [Disk] Download
 Description Terracotta config file
 Filesize 5 Kbytes
 Downloaded:  639 time(s)

hgupta

jedi

Joined: 01/22/2008 10:44:02
Messages: 104
Offline

Hi,

You can enable different types of stats in logs.
Please refer the following link for more details.
http://www.terracotta.org/confluence/display/docs1/Configuration+Guide+and+Reference#ConfigurationGuideandReference-%2Ftc%3Atcconfig%2Fclients%2Fdso%2Fdebugging

Also can you share the log files generated using the tc-config.xml you posted.

Thanks,

Himanshu Gupta,
Terracotta Inc.
hgupta

jedi

Joined: 01/22/2008 10:44:02
Messages: 104
Offline

Are you defining seperate web application section for other contexts in your tc-config.xml.

I see following in your tc-config.xml


<web-applications>
<web-application>ROOT</web-application>
</web-applications>
 


But if you are using other contexts as well then you need to declare them in the similar manner. You just mentioned you are using the same tc-config file for all your contexts.


You could do somthing like :



<web-applications>
<web-application>ROOT</web-application>
<web-application>Context1</web-application>
<web-application>Context2</web-application>
</web-applications>
 


Thanks,


Himanshu Gupta,
Terracotta Inc.
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline

Sorry i have uploaded the current version of the tc-config.xml (the one without the context that are not working). In the previous test i have done i have declared every of the webapps i want to be clustered. When i declare the other application.

writing:

<web-applications>
<web-application>ROOT</web-application>
<web-application>Context1</web-application>
...
<web-application>ContextN</web-application>
</web-applications>

The ROOT context works perfectly clustered but the other ones (Context1.. ContextN) creates a new new session on every request.


I'll try to generate clean logs with your recommendations and post them.

Sorry for the mistake in the upload it's not my intention to waste your time.

Thanks!.
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline

I have been loocking to the logs and i can see the following. When i access to ROOT context of my webapp (the one that works perfectly) i get the following log:

2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: javolution.util.FastMap$EntrySet@4e5b5d
object ID: ObjectID=[1959]
2008-03-17 11:30:47,744 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:30:47,839 [http-0.0.0.0-8080-2] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:30:47,893 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:30:47,963 [http-0.0.0.0-8080-2] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:30:54,333 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:30:56,395 [http-0.0.0.0-8080-2] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:30:56,639 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:30:57,082 [http-0.0.0.0-8080-3] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:31:07,003 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - Named lock [937680002176EFDB69EA] acquired with level WRITE (2)
2008-03-17 11:31:26,557 [SessionInvalidator - topracers] INFO com.terracottatech.dso.runtime - Named lock [tc:session_invalidator_lock_topracers] acquired with level WRITE (2)
2008-03-17 11:31:26,558 [SessionInvalidator - topracers] INFO com.tc.tcsession.topracers - SESSION INVALIDATOR: started
2008-03-17 11:31:26,558 [SessionInvalidator - topracers] INFO com.tc.tcsession.topracers - SESSION INVALIDATOR BENCH: -> total=12, evaled=0, notEvaled=12, errors=0, invalidated=0 -> elapsed=1
2008-03-17 11:31:31,645 [DSO Lock Object.wait() timer] INFO com.tc.object.lockmanager.api.ClientLockManager - ChannelID=[0]: Running Lock GC...


As you can see for every request i gets a named lock over the session [937680002176EFDB69EA] so every thing works perfectly.

The problem comes with the other context like "product" (Is another webapp on the same appserver) i get the following:

2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: java.sql.Timestamp@1b69278
object ID: ObjectID=[1830]
2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: java.sql.Timestamp@dc1c39
object ID: ObjectID=[1831]
2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: java.sql.Timestamp@c1099b
object ID: ObjectID=[1832]
2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: javolution.util.FastMap$Entry@14a062f
object ID: ObjectID=[1833]
2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: javolution.util.FastMap$Entry@15da293
object ID: ObjectID=[1834]
2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: javolution.util.FastMap$Entry@5c97f6
object ID: ObjectID=[1835]
2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: javolution.util.FastMap$Entry@fcc0b1
object ID: ObjectID=[1836]
2008-03-17 11:30:44,954 [http-0.0.0.0-8080-1] INFO com.terracottatech.dso.runtime - New DSO Object instance created
instance: javolution.util.FastMap$EntrySet@4e5b5d
object ID: ObjectID=[1959]

Every request a new DSO Object instance is createda althought the same code is used for processing the request.

I also found that:

2008-03-17 11:42:20,190 [main] INFO com.terracottatech.dso.instrumentation - org.apache.catalina.core.ContainerBase included for instrumentation
2008-03-17 11:42:20,239 [main] INFO com.terracottatech.dso.instrumentation - org.apache.catalina.connector.SessionRequest55 included for instrumentation
2008-03-17 11:42:20,291 [main] INFO com.terracottatech.dso.instrumentation - org.apache.catalina.connector.SessionResponse55 included for instrumentation
2008-03-17 11:42:20,587 [main] INFO com.terracottatech.dso.instrumentation - org.apache.catalina.loader.WebappLoader included for instrumentation

I'm using tomcat 6.0.16 and the classes that are beeing instrumented i think are from tomcat 5.5 there is any problem?.

Any idea?.
hgupta

jedi

Joined: 01/22/2008 10:44:02
Messages: 104
Offline

Hi,

Can you try the same application by replacing FastMap with a HashMap, and removing all your entries related to HashMap, in the tc-config.xml file.

Also it will be great if you can provide with a sample app which we can run as different context and reproduce the problem.

Thanks,

Himanshu Gupta,
Terracotta Inc.
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline


I'll try to follow the steps you indicated. It's not easy for me to change the FastMap to HashMap because is something that Apache OFbiz (the ERP framework we are using) uses internally. Remember that for the ROOT context the FastMap is working perfectly.

I'll try also to return to Tomcat 5.5.26 instead of 6.0.16 maybe there is an issue with the SessionReplicationValve hook of terracotta (that is for version 5.5 of tomcat) when the context is not ROOT and the appserver is Tomcat 6.0.16 (Embedded).

You can get a sample app of OFBiz from apache. I could attach one to the post but OFBiz uses a different classloading so every webapp needs from the core libs of ofbiz (that are not included directly in the lib folder of the webapp) . I think the only way to test our sample webapps is launching it inside OFBiz, sorry. If it's usefull for you i can attach it anyway but remeber that it won't run directly on tomcat.


Thanks!.
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline

First test done :) .

I have returned to tomcat 5.5.26 but the problem still exists (ROOT context works perfectly the other one creates a new session on every request).
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline

Also tested (in a simplistic way) the change from FastMap to HashMap and i get the same results.

What to do next?
hgupta

jedi

Joined: 01/22/2008 10:44:02
Messages: 104
Offline

Hi,

At this point i think that the problem you are seeing with other contexts and not with the ROOT context could be related to classloader issue.

As you said :


OFBiz uses a different classloading so every webapp needs from the core libs of ofbiz (that are not included directly in the lib folder of the webapp) .
 


The context loading mechanism for ROOT and other contexts is different in tomcat. OfBiz may be changing classloaders (or the classloader names), for same context on two different JVMs(web server).

This means that the session in two of the same webapps(context) in different JVMs, may be loaded by different classloaders and hence terracotta sees it as two different instances rather then being the same instance.

In terracotta Classloader is an identifier of a shared root.

Thanks,

Himanshu Gupta,
Terracotta Inc.
hgupta

jedi

Joined: 01/22/2008 10:44:02
Messages: 104
Offline

You can look at the following forum for more clarity on the issue.

http://forums.terracotta.org/forums/posts/list/805.page


Thanks,

Himanshu Gupta,
Terracotta Inc.
hgupta

jedi

Joined: 01/22/2008 10:44:02
Messages: 104
Offline

Hi,

Can you send the webapp, possibly during the weekend i can try to make it working and see exactly whats going on. I will need to have OfBiz framework, which i will get from the apache's site.

Thanks,

Himanshu Gupta,
Terracotta Inc.
axaubet

neo

Joined: 03/14/2008 11:15:49
Messages: 8
Offline

Thanks. I'll upload our version of OFBiz so you'll have all the settings working. OFBiz out of the box doesn't work with terracotta (i had to make the classloader hook) and review the usage of GenericValues(the type used by OFBiz to represent database data) in the http session.

I'll upload it during today.

Thanks again.

 
Forum Index -> Terracotta for Web Sessions Go to Page: 1, 2 Next 
Go to:   
Powered by JForum 2.1.7 © JForum Team