-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPE when opening Notification when running on GCP #148
Comments
It looks like you are opening a Notification in a background thread - this does not work because of the internal usage of |
The difficulty with providing an example is, that the error does not occur when running locally. It only occurs when running in the Google cloud. |
I think the current error is caused by this fix vaadin/flow#20255, that prevents thread locals leakage in background threads. |
VaadinRequest thread local is not available during a VaadinSession.access execution. VaadinRequest is used to access the HTTP session wrapper, that can be obtained through VaadinSession. The most important usage is however getting the update version header, but the lookup can be done outside the access block. This change also removes ClusterSupport registration in CurrentInstance becuase it seems not to be used anywhere and furhtermore the thread local is set only on the thread that calls serviceInit and never cleaned up. Fixes #148
Description of the bug
Starting from Vaadin version 24.4.14, when Vaadin runs in our Google cloud environment and a Notification is opened, a NullPointerException is thrown:
Cannot invoke "com.vaadin.flow.server.VaadinRequest.getWrappedSession()" because the return value of "com.vaadin.flow.server.VaadinRequest.getCurrent()" is null
Interestingly, this does not happen in version 24.4.13.
In version 24.5.0, the error does not occur anymore.
Also, the error does not occur, when running the application locally, so it might be related to the Kubernetes environment.
Even though an error is thrown, the notification is still displayed. Thus the error is only visible in the logs and not in the UI itself.
Here is the stack trace of the error:
This error is always preceeded by this other error:
Expected behavior
Opening Notification should not lead to this error.
Minimal reproducible example
Sadly not available, as a cloud environment is required
Versions
Hilla: 24.4.10
Flow: 24.4.10
Vaadin: 24.4.14
Copilot: 24.4.15
Copilot IDE Plugin: 1.3.3-intellij
Java: Eclipse Adoptium 17.0.8.1
Java Hotswap: true
Frontend Hotswap: Enabled, using Vite
OS: amd64 Windows 10 10.0
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
The text was updated successfully, but these errors were encountered: