You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Yom-Tov <jo...@sysaid.com> on 2020/05/18 14:23:36 UTC

persistentmanager loads only part of session?

Here's my setup: I have two Tomcats using PersistentManager with FileStore
to store sessions on a NFS they both have access to. Inside the session
there's an object which contains a map. I also have a request listener that
logs the contents of the map on every request.

I kill one Tomcat and I can see in the session file that the map contains
two keys. I then make a request to the remaining Tomcat and I can see the
map contains only one key.

The only way I can think of that that would happen is if the map was only
partially loaded from the file. Is that even possible? Any good ideas on
how to debug this?

Re: persistentmanager loads only part of session?

Posted by Jonathan Yom-Tov <jo...@sysaid.com>.
I don't think that can happen. I'm using sticky session so the first server
gets all requests, then I kill it and only then are requests routed to the
second server.





On Mon, 18 May 2020, 21:15 Christopher Schultz, <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Jonathan,
>
> On 5/18/20 12:52, Jonathan Yom-Tov wrote:
> > I see the persisted copy in the file and it has two keys, so I
> > don't think that's it. It's probably some sort of parallelism issue
> > since it happens only occasionally, but the map is a
> > ConcurrentHashMap, so I can't see how it would be overwritten.
>
> What happens if both servers write the file at the same time?
>
> - -chris
>
> > On Mon, 18 May 2020, 19:47 Mark Thomas, <ma...@apache.org> wrote:
> >
> >> On 18/05/2020 15:23, Jonathan Yom-Tov wrote:
> >>> Here's my setup: I have two Tomcats using PersistentManager
> >>> with
> >> FileStore
> >>> to store sessions on a NFS they both have access to. Inside the
> >>> session there's an object which contains a map. I also have a
> >>> request listener
> >> that
> >>> logs the contents of the map on every request.
> >>>
> >>> I kill one Tomcat and I can see in the session file that the
> >>> map contains two keys. I then make a request to the remaining
> >>> Tomcat and I can see the map contains only one key.
> >>>
> >>> The only way I can think of that that would happen is if the
> >>> map was only partially loaded from the file. Is that even
> >>> possible? Any good ideas on how to debug this?
> >>
> >> Best guess you add the Map containing one key to the session and
> >> then later add a second key the Map. Tomcat doesn't consider the
> >> session to be updated when the second key is added so the
> >> persisted copy doesn't get updated.
> >>
> >> Mark
> >>
> >>
> >> ---------------------------------------------------------------------
> >>
> >>
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl7C0MgACgkQHPApP6U8
> pFh8MQ/7BXrjQ9dpvDIbXBaWXXF+1jAXHccOCn471SjN4rqkn5zuyQcPASEI0Gxs
> bgfVnKRJu6ZCc5yQhkISLB4l2aE7/+duL8SRFygcaZRrVeBtRi+LSOyQQRAYqGyJ
> PbVgO0eAp823+ii93tkWgUxpRgKERmlyM+6M5R22OKHW5Erck+DLLK1xeEn8HYOU
> DvNMxS2/eawoxl811JwGfhUX/01tazV9kjeaRmVucUuqZWYQfX3qmCTAHyBDrT5b
> hu76BkZQ5/aB+sZUClZu0/PuGQ3Q8vNJjDh+FlYjpuxzm7wotJxCp682+RgkfriK
> bLE9a2Fn7Lzr2OZt2ZmPXnvMO0/Ai9Pb4Z+fMF/vWkMs6ZtH5RwxYiLfl/uzQrFj
> oH9+bNj/WXOSOLLOOFE16UZc7P59G5NvI1iEpRtzOJOSZRVDchq9nff6sSfEhK1z
> 9cOSVuBpvRSyKAhAC62G5q0eSHQ9GEJGwBREqkFAift0qn8MtjRe+XzPR9CBwcZ2
> HPwFTZ+Bs5ohqpCXijc9nwg0UwiAFefUdPEpVJHDJoRsv4IC06fagdAZaqAWeaEu
> LiY0lPWFj+7YnQ4oV9mfho19B8y1hwA6eGKaU3BSHfyc67knqZFtZYyfFVITXHh1
> E/SuOlXM3gci3vbhpHV6JqDeItmkB810Dx4McbsRUNFqu9982pc=
> =Y5dx
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: persistentmanager loads only part of session?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jonathan,

On 5/18/20 12:52, Jonathan Yom-Tov wrote:
> I see the persisted copy in the file and it has two keys, so I
> don't think that's it. It's probably some sort of parallelism issue
> since it happens only occasionally, but the map is a
> ConcurrentHashMap, so I can't see how it would be overwritten.

What happens if both servers write the file at the same time?

- -chris

> On Mon, 18 May 2020, 19:47 Mark Thomas, <ma...@apache.org> wrote:
>
>> On 18/05/2020 15:23, Jonathan Yom-Tov wrote:
>>> Here's my setup: I have two Tomcats using PersistentManager
>>> with
>> FileStore
>>> to store sessions on a NFS they both have access to. Inside the
>>> session there's an object which contains a map. I also have a
>>> request listener
>> that
>>> logs the contents of the map on every request.
>>>
>>> I kill one Tomcat and I can see in the session file that the
>>> map contains two keys. I then make a request to the remaining
>>> Tomcat and I can see the map contains only one key.
>>>
>>> The only way I can think of that that would happen is if the
>>> map was only partially loaded from the file. Is that even
>>> possible? Any good ideas on how to debug this?
>>
>> Best guess you add the Map containing one key to the session and
>> then later add a second key the Map. Tomcat doesn't consider the
>> session to be updated when the second key is added so the
>> persisted copy doesn't get updated.
>>
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>>
>>
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl7C0MgACgkQHPApP6U8
pFh8MQ/7BXrjQ9dpvDIbXBaWXXF+1jAXHccOCn471SjN4rqkn5zuyQcPASEI0Gxs
bgfVnKRJu6ZCc5yQhkISLB4l2aE7/+duL8SRFygcaZRrVeBtRi+LSOyQQRAYqGyJ
PbVgO0eAp823+ii93tkWgUxpRgKERmlyM+6M5R22OKHW5Erck+DLLK1xeEn8HYOU
DvNMxS2/eawoxl811JwGfhUX/01tazV9kjeaRmVucUuqZWYQfX3qmCTAHyBDrT5b
hu76BkZQ5/aB+sZUClZu0/PuGQ3Q8vNJjDh+FlYjpuxzm7wotJxCp682+RgkfriK
bLE9a2Fn7Lzr2OZt2ZmPXnvMO0/Ai9Pb4Z+fMF/vWkMs6ZtH5RwxYiLfl/uzQrFj
oH9+bNj/WXOSOLLOOFE16UZc7P59G5NvI1iEpRtzOJOSZRVDchq9nff6sSfEhK1z
9cOSVuBpvRSyKAhAC62G5q0eSHQ9GEJGwBREqkFAift0qn8MtjRe+XzPR9CBwcZ2
HPwFTZ+Bs5ohqpCXijc9nwg0UwiAFefUdPEpVJHDJoRsv4IC06fagdAZaqAWeaEu
LiY0lPWFj+7YnQ4oV9mfho19B8y1hwA6eGKaU3BSHfyc67knqZFtZYyfFVITXHh1
E/SuOlXM3gci3vbhpHV6JqDeItmkB810Dx4McbsRUNFqu9982pc=
=Y5dx
-----END PGP SIGNATURE-----

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


Re: persistentmanager loads only part of session?

Posted by Jonathan Yom-Tov <jo...@sysaid.com>.
I see the persisted copy in the file and it has two keys, so I don't think
that's it. It's probably some sort of parallelism issue since it happens
only occasionally, but the map is a ConcurrentHashMap, so I can't see how
it would be overwritten.





On Mon, 18 May 2020, 19:47 Mark Thomas, <ma...@apache.org> wrote:

> On 18/05/2020 15:23, Jonathan Yom-Tov wrote:
> > Here's my setup: I have two Tomcats using PersistentManager with
> FileStore
> > to store sessions on a NFS they both have access to. Inside the session
> > there's an object which contains a map. I also have a request listener
> that
> > logs the contents of the map on every request.
> >
> > I kill one Tomcat and I can see in the session file that the map contains
> > two keys. I then make a request to the remaining Tomcat and I can see the
> > map contains only one key.
> >
> > The only way I can think of that that would happen is if the map was only
> > partially loaded from the file. Is that even possible? Any good ideas on
> > how to debug this?
>
> Best guess you add the Map containing one key to the session and then
> later add a second key the Map. Tomcat doesn't consider the session to
> be updated when the second key is added so the persisted copy doesn't
> get updated.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: persistentmanager loads only part of session?

Posted by Mark Thomas <ma...@apache.org>.
On 18/05/2020 15:23, Jonathan Yom-Tov wrote:
> Here's my setup: I have two Tomcats using PersistentManager with FileStore
> to store sessions on a NFS they both have access to. Inside the session
> there's an object which contains a map. I also have a request listener that
> logs the contents of the map on every request.
> 
> I kill one Tomcat and I can see in the session file that the map contains
> two keys. I then make a request to the remaining Tomcat and I can see the
> map contains only one key.
> 
> The only way I can think of that that would happen is if the map was only
> partially loaded from the file. Is that even possible? Any good ideas on
> how to debug this?

Best guess you add the Map containing one key to the session and then
later add a second key the Map. Tomcat doesn't consider the session to
be updated when the second key is added so the persisted copy doesn't
get updated.

Mark


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