-
Notifications
You must be signed in to change notification settings - Fork 31
Description
There appears to be a bug in TJWS that it doesn't properly shut itself down. Specifically when you think you have shut down the listener in fact TJWS keeps running, it just isn't listening for connections. But it's thread pool is still alive and still holding on to objects.
This results in a number of unfun problems.
Problem 1 - Leaking memory
Problem 2 - Hosting spurious threads
Problem 3 - Java objects from Couchbase stick around so things like change trackers (for pull replication) and file handles (for the SQL databases) stick around! This means amongst other things that you can't properly delete databases and you get all sorts of fun exceptions from the 'homeless' change trackers.
So as things now stand you can't really turn the listener off properly from inside a process in Java. This is a real nightmare for testing but it's also going to be a nightmare for production code. The reason is that one of the most sane things one can do for a long running service is turn it off every once in awhile and restart it. But you can't do that in any clean way in Java due to this bug. At best you will have to spawn the listener as a completely separate process and then kill that process. Yuck!