Reputation: 2728
We are seeing a very weird situation with our web app. It uses Tomcat 6 and the web service is implemented with Jersey. The service calls below are meant to return JSON data.
The following throws OOM exception:
http://mywebservices/get/some/data/for/1
http://mywebservices/get/some/more/data/for/12345
http://mywebservices/get/some/other/data/for/abc
But, the following works fine:
http://mywebservices/get/some/data/for/12345
http://mywebservices/get/some/more/data/for/1
These are just made up calls to show what is happening. We have real time monitoring services that show ~5 GB available memory for JVM. We believe the OOM the Tomcat is throwing at us is a fake/incorrect response. The funny thing is even for completely different web services, the stack trace shown on the browser remains the same. We are very sure we are seeing the trace that is totally irrelevant given the web service request. So we are figuring out if we actually have a leak.
Meantime, it would be great to know if anybody has encountered this before.
Thanks.
Upvotes: 3
Views: 853
Reputation: 2728
Ok, so we believe we have found the root cause for this issue. There was a leak indeed because of the usage of ObjectOutputStream and ObjectInputStream.
Now ObjectOutputStream has a reset() method that can clear the references but there is nothing like that for the ObjectInputStream.
This link helped us: Java out of heap space during serialization
Upvotes: 1