You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Amit Rawat <Am...@guavus.com> on 2015/11/16 11:36:11 UTC

Tomcat simple tcp cluster doesn't work on switching browser

Hi,



I'm observing some strange behaviour between two instances of apache-tomcat-7.0.41 running on the same server. Sessions are shared between the servers on multiple logins/logouts on the same browser , but when i switch browsers , the session sharing stops .

I have posted a question on stack overflow where you can find more details on what I have tried & my observations :

http://stackoverflow.com/questions/33546555/tomcat-simple-tcp-cluster-doesnt-work-on-switching-browser

 Any help would be appreciated.


Thanks ,
Amit.

Re: Tomcat simple tcp cluster doesn't work on switching browser

Posted by Amit Rawat <Am...@guavus.com>.
Hi,

I tried to see if the connection between two tomcats is working correctly
& took a netstat with the receiver port(4010) of tomcat 2 & process
id(13437) of tomcat 1 which gives the following.
netstat -anp | grep 4010 | grep 192.168.x.x:4010 | grep 13437/java
tcp        0    580 ::ffff:192.168.x.x:41140 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java
tcp        0    578 ::ffff:192.168.x.x:41136 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java


netstat -anp | grep 4010 | grep 192.168.x.x:4010 | grep 13437/java
tcp        0    580 ::ffff:192.168.x.x:41146 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java
tcp        0    826 ::ffff:192.168.x.x:41151 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java


netstat -anp | grep 4010 | grep 192.168.x.x:4010 | grep 13437/java
tcp        0    757 ::ffff:192.168.x.x:41223 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java


netstat -anp | grep 4010 | grep 192.168.x.x:4010 | grep 13437/java
tcp        0    580 ::ffff:192.168.x.x:41292 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java
tcp        0    757 ::ffff:192.168.x.x:41286 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java
tcp        0    578 ::ffff:192.168.x.x:41282 ::ffff:192.168.x.x:4010
ESTABLISHED 13437/java
tcp        0      1 ::ffff:192.168.x.x:41293 ::ffff:192.168.x.x:4010
SYN_SENT    13437/java


netstat -anp | grep 4010 | grep 192.168.x.x:4010 | grep 13437/java


I have two observations :
a) The no of connections keeps changing form 0 to 4 .
b) When this issue occurs , the Receive queue starts filling up

Is observation 'a' normal behaviour? And are there ways to identify why
the receive queue filling up ?





On 17/11/15 3:06 pm, "Amit Rawat" <Am...@guavus.com> wrote:

>Hi Chris,
>
>It might seem that both are going to SERVER-1 because I have set the
>jvmRoute for both instances of tomcat is set to SERVER-1. I had started
>with setting different jvmRoute for both and I faced the same issue . Then
>I tried setting them the same since I thought jvmRoute should be unique to
>the server therefore I used server name . Although now I think they should
>be unique to the tomcat instance.
>
>I am not using a load balancer. The two tomcats expose different services
>& I need to share sessions between those services for a logged in user.
>The scenario is that I login through tomcat 1, query it a few times, then
>query tomcat 2 using the same session-id .
>
>My apologies if it seemed rude , but I pasted the link to my questions on
>SO as I didn¹t want the mail to be too long & unreadable . Also, the post
>on SO , has links to other SO suggestions that I have already tried.
>Again, my apologies, it was not my intention to be either lazy or rude.
>
>
>Thanks for the reply,
>Amit
>
>On 17/11/15 3:28 am, "Christopher Schultz" <ch...@christopherschultz.net>
>wrote:
>
>>Amit,
>>
>>On 11/16/15 7:21 AM, Amit Rawat wrote:
>>> Thanks for the reply. I understand that on changing browsers, a new
>>> session would need to be established & that is indeed what I do . On
>>> changing browsers , I login again , creating a new session .
>>> As can be seen in the logs I pasted on stack overflow : New Session :::
>>> 6003A09956987A2035EB9BB1C5D7C157.SERVER-1 . But as you can see from the
>>> logs , the sessions created or destroyed are not shared with the other
>>> tomcat by the tomcat to which I send my requests .
>>
>>It's not clear which Tomcat is receiving which requests... they all look
>>like they are going to SERVER-1. Are you sure your lb is working as
>>expected?
>>
>>While some of us lurk on SO, posting to this list and asking people to
>>go to SO to answer your question is a little lazy (or perhaps rude). IF
>>you want real advice, come here and give us all the information we need
>>to help you. Then stick around and become part of the community. If you
>>just want random advice from people on the internet, stick with SO.
>>
>>-chris
>>
>>> On 16/11/15 5:30 pm, "André Warnier (tomcat)" <aw...@ice-sa.com> wrote:
>>> 
>>>> On 16.11.2015 11:36, Amit Rawat wrote:
>>>>> Hi,
>>>>>
>>>>>
>>>>>
>>>>> I'm observing some strange behaviour between two instances of
>>>>> apache-tomcat-7.0.41 running on the same server. Sessions are shared
>>>>> between the servers on multiple logins/logouts on the same browser ,
>>>>>but
>>>>> when i switch browsers , the session sharing stops .
>>>>>
>>>>> I have posted a question on stack overflow where you can find more
>>>>> details on what I have tried & my observations :
>>>>>
>>>>>
>>>>> 
>>>>>http://stackoverflow.com/questions/33546555/tomcat-simple-tcp-cluster-
>>>>>d
>>>>>oe
>>>>> snt-work-on-switching-browser
>>>>>
>>>>>   Any help would be appreciated.
>>>>>
>>>>
>>>> Off the top of my head, I would say
>>>> - a "session" saved on the server, is identified by a "session-id"
>>>>(some
>>>> kind of large 
>>>> alphanumeric string, unique)
>>>> - to allow a browser to re-connect to the same session during several
>>>> interactions, this
>>>> session-id is initially sent to the browser, contained in a cookie
>>>> - whenever the browser interacts with the same server/cluster, it
>>>>resends
>>>> this cookie, and
>>>> this is what allows the server to re-connect this browser to the saved
>>>> session
>>>>
>>>> - of course, if you switch browsers, the new browser does not have
>>>>that
>>>> cookie. So it does
>>>> not send it to the server/cluster, and it gets a new session, with a
>>>> different session-id.
>>>>
>>>> Or did I misunderstand your explanation of what happens ?
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> 
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat simple tcp cluster doesn't work on switching browser

Posted by Amit Rawat <Am...@guavus.com>.
Hi Chris,

It might seem that both are going to SERVER-1 because I have set the
jvmRoute for both instances of tomcat is set to SERVER-1. I had started
with setting different jvmRoute for both and I faced the same issue . Then
I tried setting them the same since I thought jvmRoute should be unique to
the server therefore I used server name . Although now I think they should
be unique to the tomcat instance.

I am not using a load balancer. The two tomcats expose different services
& I need to share sessions between those services for a logged in user.
The scenario is that I login through tomcat 1, query it a few times, then
query tomcat 2 using the same session-id .

My apologies if it seemed rude , but I pasted the link to my questions on
SO as I didn¹t want the mail to be too long & unreadable . Also, the post
on SO , has links to other SO suggestions that I have already tried.
Again, my apologies, it was not my intention to be either lazy or rude.


Thanks for the reply,
Amit

On 17/11/15 3:28 am, "Christopher Schultz" <ch...@christopherschultz.net>
wrote:

>Amit,
>
>On 11/16/15 7:21 AM, Amit Rawat wrote:
>> Thanks for the reply. I understand that on changing browsers, a new
>> session would need to be established & that is indeed what I do . On
>> changing browsers , I login again , creating a new session .
>> As can be seen in the logs I pasted on stack overflow : New Session :::
>> 6003A09956987A2035EB9BB1C5D7C157.SERVER-1 . But as you can see from the
>> logs , the sessions created or destroyed are not shared with the other
>> tomcat by the tomcat to which I send my requests .
>
>It's not clear which Tomcat is receiving which requests... they all look
>like they are going to SERVER-1. Are you sure your lb is working as
>expected?
>
>While some of us lurk on SO, posting to this list and asking people to
>go to SO to answer your question is a little lazy (or perhaps rude). IF
>you want real advice, come here and give us all the information we need
>to help you. Then stick around and become part of the community. If you
>just want random advice from people on the internet, stick with SO.
>
>-chris
>
>> On 16/11/15 5:30 pm, "André Warnier (tomcat)" <aw...@ice-sa.com> wrote:
>> 
>>> On 16.11.2015 11:36, Amit Rawat wrote:
>>>> Hi,
>>>>
>>>>
>>>>
>>>> I'm observing some strange behaviour between two instances of
>>>> apache-tomcat-7.0.41 running on the same server. Sessions are shared
>>>> between the servers on multiple logins/logouts on the same browser ,
>>>>but
>>>> when i switch browsers , the session sharing stops .
>>>>
>>>> I have posted a question on stack overflow where you can find more
>>>> details on what I have tried & my observations :
>>>>
>>>>
>>>> 
>>>>http://stackoverflow.com/questions/33546555/tomcat-simple-tcp-cluster-d
>>>>oe
>>>> snt-work-on-switching-browser
>>>>
>>>>   Any help would be appreciated.
>>>>
>>>
>>> Off the top of my head, I would say
>>> - a "session" saved on the server, is identified by a "session-id"
>>>(some
>>> kind of large 
>>> alphanumeric string, unique)
>>> - to allow a browser to re-connect to the same session during several
>>> interactions, this
>>> session-id is initially sent to the browser, contained in a cookie
>>> - whenever the browser interacts with the same server/cluster, it
>>>resends
>>> this cookie, and
>>> this is what allows the server to re-connect this browser to the saved
>>> session
>>>
>>> - of course, if you switch browsers, the new browser does not have that
>>> cookie. So it does
>>> not send it to the server/cluster, and it gets a new session, with a
>>> different session-id.
>>>
>>> Or did I misunderstand your explanation of what happens ?
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat simple tcp cluster doesn't work on switching browser

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Amit,

On 11/16/15 7:21 AM, Amit Rawat wrote:
> Thanks for the reply. I understand that on changing browsers, a new
> session would need to be established & that is indeed what I do . On
> changing browsers , I login again , creating a new session .
> As can be seen in the logs I pasted on stack overflow : New Session :::
> 6003A09956987A2035EB9BB1C5D7C157.SERVER-1 . But as you can see from the
> logs , the sessions created or destroyed are not shared with the other
> tomcat by the tomcat to which I send my requests .

It's not clear which Tomcat is receiving which requests... they all look
like they are going to SERVER-1. Are you sure your lb is working as
expected?

While some of us lurk on SO, posting to this list and asking people to
go to SO to answer your question is a little lazy (or perhaps rude). IF
you want real advice, come here and give us all the information we need
to help you. Then stick around and become part of the community. If you
just want random advice from people on the internet, stick with SO.

-chris

> On 16/11/15 5:30 pm, "André Warnier (tomcat)" <aw...@ice-sa.com> wrote:
> 
>> On 16.11.2015 11:36, Amit Rawat wrote:
>>> Hi,
>>>
>>>
>>>
>>> I'm observing some strange behaviour between two instances of
>>> apache-tomcat-7.0.41 running on the same server. Sessions are shared
>>> between the servers on multiple logins/logouts on the same browser , but
>>> when i switch browsers , the session sharing stops .
>>>
>>> I have posted a question on stack overflow where you can find more
>>> details on what I have tried & my observations :
>>>
>>>
>>> http://stackoverflow.com/questions/33546555/tomcat-simple-tcp-cluster-doe
>>> snt-work-on-switching-browser
>>>
>>>   Any help would be appreciated.
>>>
>>
>> Off the top of my head, I would say
>> - a "session" saved on the server, is identified by a "session-id" (some
>> kind of large 
>> alphanumeric string, unique)
>> - to allow a browser to re-connect to the same session during several
>> interactions, this
>> session-id is initially sent to the browser, contained in a cookie
>> - whenever the browser interacts with the same server/cluster, it resends
>> this cookie, and 
>> this is what allows the server to re-connect this browser to the saved
>> session
>>
>> - of course, if you switch browsers, the new browser does not have that
>> cookie. So it does
>> not send it to the server/cluster, and it gets a new session, with a
>> different session-id.
>>
>> Or did I misunderstand your explanation of what happens ?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat simple tcp cluster doesn't work on switching browser

Posted by Amit Rawat <Am...@guavus.com>.
Hi André,

Thanks for the reply. I understand that on changing browsers, a new
session would need to be established & that is indeed what I do . On
changing browsers , I login again , creating a new session .
As can be seen in the logs I pasted on stack overflow : New Session :::
6003A09956987A2035EB9BB1C5D7C157.SERVER-1 . But as you can see from the
logs , the sessions created or destroyed are not shared with the other
tomcat by the tomcat to which I send my requests .

On 16/11/15 5:30 pm, "André Warnier (tomcat)" <aw...@ice-sa.com> wrote:

>On 16.11.2015 11:36, Amit Rawat wrote:
>> Hi,
>>
>>
>>
>> I'm observing some strange behaviour between two instances of
>>apache-tomcat-7.0.41 running on the same server. Sessions are shared
>>between the servers on multiple logins/logouts on the same browser , but
>>when i switch browsers , the session sharing stops .
>>
>> I have posted a question on stack overflow where you can find more
>>details on what I have tried & my observations :
>>
>> 
>>http://stackoverflow.com/questions/33546555/tomcat-simple-tcp-cluster-doe
>>snt-work-on-switching-browser
>>
>>   Any help would be appreciated.
>>
>
>Off the top of my head, I would say
>- a "session" saved on the server, is identified by a "session-id" (some
>kind of large 
>alphanumeric string, unique)
>- to allow a browser to re-connect to the same session during several
>interactions, this
>session-id is initially sent to the browser, contained in a cookie
>- whenever the browser interacts with the same server/cluster, it resends
>this cookie, and 
>this is what allows the server to re-connect this browser to the saved
>session
>
>- of course, if you switch browsers, the new browser does not have that
>cookie. So it does
>not send it to the server/cluster, and it gets a new session, with a
>different session-id.
>
>Or did I misunderstand your explanation of what happens ?
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat simple tcp cluster doesn't work on switching browser

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 16.11.2015 11:36, Amit Rawat wrote:
> Hi,
>
>
>
> I'm observing some strange behaviour between two instances of apache-tomcat-7.0.41 running on the same server. Sessions are shared between the servers on multiple logins/logouts on the same browser , but when i switch browsers , the session sharing stops .
>
> I have posted a question on stack overflow where you can find more details on what I have tried & my observations :
>
> http://stackoverflow.com/questions/33546555/tomcat-simple-tcp-cluster-doesnt-work-on-switching-browser
>
>   Any help would be appreciated.
>

Off the top of my head, I would say
- a "session" saved on the server, is identified by a "session-id" (some kind of large 
alphanumeric string, unique)
- to allow a browser to re-connect to the same session during several interactions, this 
session-id is initially sent to the browser, contained in a cookie
- whenever the browser interacts with the same server/cluster, it resends this cookie, and 
this is what allows the server to re-connect this browser to the saved session

- of course, if you switch browsers, the new browser does not have that cookie. So it does 
not send it to the server/cluster, and it gets a new session, with a different session-id.

Or did I misunderstand your explanation of what happens ?




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org