-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jerry,

On 8/15/18 12:14 PM, Jerry Malcolm wrote:
> I have a mobile app that issues several http web service calls to 
> initialize.  I was making them sequentially with no issues.  I
> then changed to give them all separate threads so they could load 
> asynchronously.  Then the bottom fell out.  I started getting
> empty responses and some responses with results of three or four of
> the calls concatenated.  I traced the problem from the app back
> through apache through mod_jk and found the culprit to be Tomcat.
> 
> I'm a seasoned Tomcat developer for over 15 years.  I've never
> seen anything like this.  But it's really scary.  What I found is
> that sometime during the execution of one servlet call, it's thread
> data is swapped to thread data of another servlet call.  I know
> this sounds like Twilight Zone.  But here is a log output. At the
> beginning of doGet(), I generated a random text string just to keep
> track of the thread data/:/
> 
> Thread: ajp-nio-8009-exec-24 uid: rclebgb --> Thread:
> ajp-nio-8009-exec-29 uid: ceycfqd --> Thread: ajp-nio-8009-exec-29
> uid: ceycfqd <-- Thread: ajp-nio-8009-exec-24 uid: ceycfqd <--
> 
> Note that when thread 24 starts I store the "rcl..." uid. Another
> call comes in and starts thread 29.  By the time thread 24's
> servlet code is done, it now has thread 29's data.  (The uid is
> just a quick variable for reference.  The request object, response
> object, EVERYTHING is now thread 29's data).
> 
> This explains why I'm getting empty responses and other response
> with the data for multiple requests concatenated together.  The
> "rcl..." instance data has totally disappeared, and all of the
> server calls are now using the "cey..." instance data (i.e.
> response object).
> 
> I figure this is some sort of timing/race condition that only
> occurs with a second call coming in while the first call is still
> in progress. I can go back to sending the mobile app calls serially
> and probably work around this.  But this is a huge problem.
> 
> Any ideas?  (BTW... Tomcat 9.0.7)

Some more specific questions thatn what Olaf has already asked:

1. Where is your "uid" being stored?
2. What does your code look like? Can you just post some of it? We
really don't care what your application is doing, of course. Just the
parts that generate+log the "uids" you are showing to us.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlt0g7gACgkQHPApP6U8
pFjxcQ/9GdFR302AfkCzCW2WDLqOYlcV/WqGHv2qIq3G5Eyv6b8fRHlqncg6QGbv
JZOMT1DHvfWYnMZ/XOcVbF1AdRfpCx4TUPuuaw4YoeS4kqghGKM3L545+Uavm5Qi
8I1GR5NL87fpFExifWrjqVgDIWGXmsHHG0TPwyWq16ALJ8IQ0jStbGdft82AEZeF
jUkbt2/+aDvKsGJhqROQ/Z+QnA+F9u6NW2vZTP2zhb2S9Max1L/MHySx3WLZv4aN
72sS592+KquSMOw1068Wj+BdsIN6ag6HOaNc/o3WCRivcLd/bQbZ4+v8UoegruRW
DK57voXd28lMBZI0SOU4sCLJpRctdprA8+zIsEiHKx4ln6UD+SHg3C9MGHhED5vp
zRI6dFTcuzoQ3f6/LTp3zNXqBsxTWPyF7C82CphRP0BOfQT526a4D0GkAO4BpdAU
Xm9tEpy1jQEyLplOWRctrSdy/e1uaqlJ3F+3/dkZEn+zfV9hpnMQ76BS8Mrei+Ke
aH8K5f6Ahak4iaey69nUKe8vVhGHex3uq8oo94Ud+mMVlSeWNFvcY8Kb7ByjAcUb
z3SsqTsGRHcmdJGg3Ku3FNpLEi9HkdZaAhGxENBg1lOd0oKHOEE/fsvnB83tartc
Aqjan2IdjHtil5vYRiQQqqmZ372KLIpxTfle1cj0PoJgd/P52DI=
=tZjO
-----END PGP SIGNATURE-----

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

Reply via email to