Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix: Properly unload failed app #25386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

OndroMih
Copy link
Contributor

Without this change, failed deployment failed to trigger some events that usually happen during undeployment. This fixes the error handler to properly clean everything up and trigger events that correspond to deploy and undeploy called in a sequence.

Tested with:

  • Deployment error: deploy --name app1 --contextroot / app.war && deploy --name app2 --contextroot / app.war - deploys an app with name "app1" (success), then deploys the same app, same context root, with name "app2" - failure because the context root must be unique
  • Deployment success & undeploy: deploy --name app1 app.war && undeploy app1 -

Without this change, the events trigger :

Deployment error Deployment success & undeploy
Event type: "Initial_Context_Created" Event type: "Initial_Context_Created"
Event type: "Deployment_Start" Event type: "Deployment_Start"
Event type: "After_Deployment_ClassLoader_Creation" Event type: "After_Deployment_ClassLoader_Creation"
Event type: "Deployment_ClassLoader_Creation" Event type: "Deployment_ClassLoader_Creation"
Event type: "After_Application_ClassLoader_Creation" Event type: "After_Application_ClassLoader_Creation"
Event type: "Module_Prepared" Event type: "Module_Prepared"
Event type: "Application_Prepared" Event type: "Application_Prepared"
Event type: "Module_Loaded" Event type: "Module_Loaded"
Event type: "Module_Loaded" Event type: "Module_Loaded"
Event type: "Application_Loaded" Event type: "Application_Loaded"
Event type: "Module_Running" Event type: "Module_Running"
Event type: "After_Servlet_Context_Initialized"
Event type: "Module_Running"
Event type: "Application_Running"
Event type: "Deployment_Success"
Event type: "Undeployment_Validation"
Event type: "Undeployment_Start"
Event type: "Module_Stopped"
Event type: "Module_Stopped"
Event type: "Application_Stopped"
Event type: "Module_Unloaded"
Event type: "Module_Unloaded"
Event type: "Application_Unloaded"
Event type: "Application_Disabled" Event type: "Application_Disabled"
Event type: "Module_Cleaned"
Event type: "Module_Cleaned"
Event type: "Application_Cleaned"
Event type: "Undeployment_Success"
Event type: "Deployment_Failed"

With this change, all relevant events are triggered:

Deployment error Deployment success & undeploy
Event type: "Initial_Context_Created" Event type: "Initial_Context_Created"
Event type: "Deployment_Start" Event type: "Deployment_Start"
Event type: "After_Deployment_ClassLoader_Creation" Event type: "After_Deployment_ClassLoader_Creation"
Event type: "Deployment_ClassLoader_Creation" Event type: "Deployment_ClassLoader_Creation"
Event type: "After_Application_ClassLoader_Creation" Event type: "After_Application_ClassLoader_Creation"
Event type: "Module_Prepared" Event type: "Module_Prepared"
Event type: "Application_Prepared" Event type: "Application_Prepared"
Event type: "Module_Loaded" Event type: "Module_Loaded"
Event type: "Module_Loaded" Event type: "Module_Loaded"
Event type: "Application_Loaded" Event type: "Application_Loaded"
Event type: "Module_Running" Event type: "Module_Running"
Event type: "After_Servlet_Context_Initialized"
Event type: "Module_Running"
Event type: "Application_Running"
Event type: "Deployment_Success"
Event type: "Undeployment_Validation"
Event type: "Undeployment_Start"
Event type: "Module_Stopped"
Event type: "Module_Stopped" Event type: "Module_Stopped"
Event type: "Application_Stopped" Event type: "Application_Stopped"
Event type: "Module_Unloaded" Event type: "Module_Unloaded"
Event type: "Module_Unloaded" Event type: "Module_Unloaded"
Event type: "Application_Unloaded" Event type: "Application_Unloaded"
Event type: "Application_Disabled" Event type: "Application_Disabled"
Event type: "Module_Cleaned" Event type: "Module_Cleaned"
Event type: "Module_Cleaned" Event type: "Module_Cleaned"
Event type: "Application_Cleaned" Event type: "Application_Cleaned"
Event type: "Undeployment_Success"
Event type: "Deployment_Failed"

Before it failed to trigger some events that usually happen during undeployment. This fixes the error handler to properly clean everything up and trigger corresponding events.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant