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

CDI container is not available during shutdown #2421

Closed
tomas-langer opened this issue Oct 7, 2020 · 0 comments · Fixed by #2438
Closed

CDI container is not available during shutdown #2421

tomas-langer opened this issue Oct 7, 2020 · 0 comments · Fixed by #2438
Assignees
Labels
2.x Issues for 2.x version branch bug Something isn't working cdi CDI P2
Projects

Comments

@tomas-langer
Copy link
Member

When the container.close() is called, we may get an exception from HelidonContainerImpl that Container not running.

This is because we set the "not running" before finalizing the container work. One of the things it does is that it triggers events (such as Application scoped before destroyed event) that may in turn instantiate beans. If such a bean uses CDI.current(), it breaks.

To reproduce:

  • create a bean that is not used by the application at all
  • add the following method
    public void method(@Observes @BeforeDestroyed(ApplicationScoped.class) Object event) {
      CDI.current().getBeanManager()
    }
  • start the container
  • stop the container

The "stop" part should throw an exception as described above.
Correct behavior:
The CDI.current() should work (maybe we could issue a single warning with stacktrace, such as "container is shutting down, yet CDI was requested)

@tomas-langer tomas-langer added bug Something isn't working cdi CDI 2.x Issues for 2.x version branch labels Oct 7, 2020
@tomas-langer tomas-langer added this to Needs triage in Backlog via automation Oct 7, 2020
@m0mus m0mus added the P1 label Oct 8, 2020
@m0mus m0mus added P2 and removed P1 labels Oct 8, 2020
@m0mus m0mus moved this from Needs triage to High priority in Backlog Oct 8, 2020
@tomas-langer tomas-langer moved this from High priority to In Progress in Backlog Oct 12, 2020
Backlog automation moved this from In Progress to Closed Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issues for 2.x version branch bug Something isn't working cdi CDI P2
Projects
Backlog
  
Closed
Development

Successfully merging a pull request may close this issue.

2 participants