Skip to content
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

fix: prevent exception getting DevModeHandlerManager on application shutdown #19300

Merged
merged 1 commit into from
May 6, 2024

Conversation

mcollovati
Copy link
Collaborator

Description

During the destruction of the web applicationi context, the DevModeStartupListener's context destroy listener is invoked. This listener attempts to locate the DevModeHandlerManager to halt the Vaadin dev-server. However, this process could trigger an exception if the dependency injection container behind the Lookup mechanism has already been stopped.
This commit addresses the issue by capturing a reference to the handler during web context start, eliminating the need for a lookup during destruction, thus preventing potential exceptions.

Fixes #19183

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

…hutdown

During the destruction of the web applicationi context, the
DevModeStartupListener's context destroy listener is invoked.
This listener attempts to locate the DevModeHandlerManager to
halt the Vaadin dev-server. However, this process could trigger
an exception if the dependency injection container behind the
Lookup mechanism has already been stopped.
This commit addresses the issue by capturing a reference to the
handler during web context start, eliminating the need for a
lookup during destruction, thus preventing potential exceptions.

Fixes #19183
Copy link

sonarcloud bot commented May 2, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

github-actions bot commented May 2, 2024

Test Results

1 100 files  +1  1 100 suites  +1   1h 27m 31s ⏱️ + 5m 43s
7 010 tests +1  6 961 ✅ +2  49 💤 ±0  0 ❌ ±0 
7 383 runs  +7  7 322 ✅ +8  61 💤 ±0  0 ❌ ±0 

Results for commit 3da8e05. ± Comparison against base commit 2f08856.

@caalador caalador merged commit be17780 into main May 6, 2024
26 checks passed
@caalador caalador deleted the issues/19183_spring_devmodehandler_stop branch May 6, 2024 06:19
vaadin-bot pushed a commit that referenced this pull request May 6, 2024
…hutdown (#19300)

During the destruction of the web applicationi context, the
DevModeStartupListener's context destroy listener is invoked.
This listener attempts to locate the DevModeHandlerManager to
halt the Vaadin dev-server. However, this process could trigger
an exception if the dependency injection container behind the
Lookup mechanism has already been stopped.
This commit addresses the issue by capturing a reference to the
handler during web context start, eliminating the need for a
lookup during destruction, thus preventing potential exceptions.

Fixes #19183
vaadin-bot pushed a commit that referenced this pull request May 6, 2024
…hutdown (#19300)

During the destruction of the web applicationi context, the
DevModeStartupListener's context destroy listener is invoked.
This listener attempts to locate the DevModeHandlerManager to
halt the Vaadin dev-server. However, this process could trigger
an exception if the dependency injection container behind the
Lookup mechanism has already been stopped.
This commit addresses the issue by capturing a reference to the
handler during web context start, eliminating the need for a
lookup during destruction, thus preventing potential exceptions.

Fixes #19183
vaadin-bot added a commit that referenced this pull request May 6, 2024
…hutdown (#19300) (#19306)

During the destruction of the web applicationi context, the
DevModeStartupListener's context destroy listener is invoked.
This listener attempts to locate the DevModeHandlerManager to
halt the Vaadin dev-server. However, this process could trigger
an exception if the dependency injection container behind the
Lookup mechanism has already been stopped.
This commit addresses the issue by capturing a reference to the
handler during web context start, eliminating the need for a
lookup during destruction, thus preventing potential exceptions.

Fixes #19183

Co-authored-by: Marco Collovati <marco@vaadin.com>
vaadin-bot added a commit that referenced this pull request May 6, 2024
…hutdown (#19300) (#19307)

During the destruction of the web applicationi context, the
DevModeStartupListener's context destroy listener is invoked.
This listener attempts to locate the DevModeHandlerManager to
halt the Vaadin dev-server. However, this process could trigger
an exception if the dependency injection container behind the
Lookup mechanism has already been stopped.
This commit addresses the issue by capturing a reference to the
handler during web context start, eliminating the need for a
lookup during destruction, thus preventing potential exceptions.

Fixes #19183

Co-authored-by: Marco Collovati <marco@vaadin.com>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.5.0.alpha1 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

NullPointerException in DevModeStartupListener.contextDestroyed() on shutdown
3 participants