- Call close() on all database connections.
- Both in the MySQL driver and the MongoDB driver.
- Make sure all HttpExchange objects are properly cleaned up after a response is sent.
- Added a finally clause to the sendResponse() method in the Resource object code that assures the closing of the input/output streams and a final call to the exchange.close() method.
The next couple of week I tried everything: tracers, logging, etc. Nothing was clearing this bug. So I finally decided to just dig through the datapath. Data is submitted, forwarded to the subscription engine and finally placed in MongoDB. I added in arbitrary delays and it turns out that’s what caused the problem. The process described above was entirely serialized:
- Forward to subscribers
- Save in database