You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
yaronyg
added a commit
to yaronyg/thali
that referenced
this issue
Mar 27, 2014
JavaEktorpCreateClientBuilderTest - Needed to create a new temporary
directory on each test run because just shutting off the listener
doesn't appear to really shut it off (threads are still running) and
this appears to stop it from releasing file handles which means the
set up for the next test fails when it tries to delete the test databases.
couchbase/couchbase-lite-java-listener#43
Put in work around for timing bug in TJWS - couchbase/couchbase-lite-java-listener#40
yaronyg
changed the title
Is there any way to actually kill the listener?
The listener can never be properly killed in Java from inside of a process
Apr 2, 2014
yaronyg
pushed a commit
to yaronyg/thali
that referenced
this issue
Apr 2, 2014
I changed our tests to create a single listener and re-use it for each test.
This isn't ideal since it's not clean. The ideal solution is to start a new
listener for each test. But there is a bug in TJWS that in Java when you
'shut it down' it actually leaves all of its threads running and they
do fun things like maintain locks on files and such. This is filed as
couchbase/couchbase-lite-java-listener#43
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!
The text was updated successfully, but these errors were encountered: