Active UIThreads cause Jetty server shutdown to hang
This seems to be the same as https://bugs.eclipse.org/bugs/show_bug.cgi?id=360630 which is a very old bug, but we are encountering it again.
We are running a RAP UI in a Jetty server. We have found that if the server is stopped, the stop code never finishes if there are UI sessions connected. If there are no UI sessions, the shutdown proceeds as normal.
I believe this is the same as the above bug since I've seen the Framework Stop thread waiting for the UI thread, but the UI thread is also waiting on itself, and there is nobody to notify them.
When it gets blocked in RWTLifeCycle we have the following note:
// In any case: wait for the thread to be terminated by session timeout
uiThread.switchThread();
I'm not really sure which session timeout this is referring to. I've tried setting the timeout in web.xml and even the Jetty server very low (1 minute or so), but it still waits for uiThread.switchThread() seemingly forever.
The above bug report also mentions about UIThread.getLock(), and we see this note in the code:
@Override
public Object getLock() {
// TODO [rh] use a distinct (final) lock object instead of 'this'
return this;
}
Would fixing this lock issue also fix this bug?
I haven't been able to find any workarounds, and I'm not very familiar with all of this. I was attempting to reproduce it with the RAP example applications but have been unable to since I always get 404 in the browser.
We are using RAP 3.29 for the record, since we are unable to upgrade to 4.0 since we are using an older version of Jetty. But I don't necessarily see a reason that it should be fixed there.
If there are any workarounds or things I can check to verify that I am doing everything correctly please let me know. Our current workaround on the server-side is to create ANOTHER thread which forcefully interrupts the Jetty shutdown code if it takes too long, but this isn't really desirable.
Also reported in https://bugs.eclipse.org/bugs/show_bug.cgi?id=409843