Open mshabarov opened 1 year ago
I only get [JNA Cleaner]
on the first reload and never again for future reloads for changes.
I get the same for Flow applications with Vaadin 24.2.0.rc1.
But with Hilla base starter with Hilla 2.3.0.alpha11 and 2.3-SNAPSHOT I get a lot of warnings as given in the description.
EDIT: can get these warnings with Vite dev server enabled for Flow application. So the culprit is a dev server codes that connects to the dev server.
In Flow core there are three places of using HttpClient that I could find:
StatisticsSender
DefaultFileDownloader
ViteWebsocketConnection
StatisticsSender can be switched off by config parameter and even then I got warnings. DefaultFileDownloader downloads Node.js and during server reloads it isn't triggered.
The last one, ViteWebsocketConnection is a culprit. WebSocket connection is closed via
CompletableFuture<WebSocket> closeRequest = clientWebSocket
.sendClose(CloseCodes.NORMAL_CLOSURE.getCode(), "");
closeRequest.get();
but probably some threads for sending messages in send()
aren't completed due to waiting for data to be sent to Vite.
Tried with timeout, but no success:
send.get(100, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
getLogger().debug("Message not sent because of timeout", e);
}
When hot deploying a Java changes in Flow or Hilla applications
For me, the error occurs on the first run of a fresh skeleton project even without any code changes.
I also only get warning about [JNA Cleaner]
thread, and also just once after first reload. It originates from thread from com.sun.jna.iternal.Cleaner
class which is from the latest JNA 5.13.0
.
Looks like a fix for it in 5.14.0
will be released soon (in few weeks) so I suggest to wait for it: https://groups.google.com/g/jna-users/c/OjCQEHaDagI
https://github.com/java-native-access/jna/releases/tag/5.14.0 is now released. Can we upgrade?
Upgraded in the license checker https://github.com/vaadin/license-checker-vaadin10/pull/121. Flow doesn't seem to have oshi/jna explicit version.
Description of the bug
When hot deploying a Java changes in Flow or Hilla applications, the following warn messages appear in the server logs:
A possible workaround to suppress the warning would be to supply an
Executor
to theHttpClient.Builder
, and shutdown thisExecutor
in the main method of the app. The permanent solution might be to place shutdown intoVaadinService::destroy
.Also, we might consider to reuse those threads over redeploys to avoid spending time on waiting for the executor to be closed.
Expected behavior
No warnings in the logs.
Minimal reproducible example
Download starter project from https://start.vaadin.com, run it, apply Java changes and recompile to trigger a reload.
Versions