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

Improve app state checking and fix deployment issues #21

Merged
merged 4 commits into from
Jul 18, 2018

Conversation

Azquelt
Copy link
Member

@Azquelt Azquelt commented Jul 11, 2018

Short description of what this resolves:

Avoid the case where the container sees the app in INSTALLED state and assumes that it has failed to start when actually liberty hasn't attempted to start it yet.

Avoid the case where liberty tries to start an application deployed to dropins before the container has finished writing it.

Create the apps and dropins directories if they do not exist and are required.

Changes proposed in this pull request:

  • Improve logging of deployments (was needed to debug this problem so is probably useful for debugging any future issues)
  • Refactor the app state checking
  • Only assume the app has failed to start if it remains in INSTALLED state for 1 second (this should be plenty of time, usually it moves from INSTALLED to STARTING so quickly that the container doesn't even see it.
  • When deploying to dropins, deploy to a temporary location first, then move the app into the dropins directory. This should prevent liberty from seeing the app and trying to start it before the container has finished writing it.
  • When deploying to the apps or dropins directories, create them if they don't exist.

Fixes: #18 #16

@Azquelt
Copy link
Member Author

Azquelt commented Jul 12, 2018

I've used String.join() which isn't present on Java 7, will fix that.

Add logging to deployment/undeployment to help debug occasional
deployment issues.
Fixes OpenLiberty#18  where the container very briefly sees the app in INSTALLED
state before liberty begins starting it and assumes that it has failed
to start.

Also did some refactoring and cleanup of the application state checking
code.
Fixes OpenLiberty#16 by ensuring the apps and dropins directories are created if
they're needed.

Fixes OpenLiberty#18 by exporting the app to a temporary location and then moving
it into the dropins directory.
@Azquelt Azquelt force-pushed the improve-app-state-checking branch from ac4186b to 4776c49 Compare July 17, 2018 09:39
@Azquelt
Copy link
Member Author

Azquelt commented Jul 17, 2018

When testing my fix in the liberty build, I needed both this fix and #19 . They conflict so I've rebased #19 into this PR to submit them both together.

I'll update the PR description accordingly

@Azquelt Azquelt changed the title Improve app state checking Improve app state checking and fix deployment issues Jul 17, 2018
@Azquelt
Copy link
Member Author

Azquelt commented Jul 18, 2018

Did a few more liberty builds with these changes and I'm pretty convinced that it fixes the issues we've been seeing.

It's ready to be reviewed and merged.

@@ -398,6 +387,9 @@ public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentExcept
try {
// If the deployment is to server.xml, then update server.xml with the application information
if (containerConfiguration.isDeployTypeXML()) {
if (log.isLoggable(FINER)) {
log.finer("Deploying using server.xml");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK but I might have included the archiveName in the log msg.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think having the archive name here is necessary as it'll be included with the archive details (logged at the same level on line 376)

appMessageStatus.append("Timeout while waiting for \"")
.append(appStateChecker.getAppName())
.append("\" ApplicationMBean to reach ")
.append(desiredState);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see where it logs the actual state (what used to be "status") at the error level or in then exception. It is logged as currentState in line 951 but at a logging level that is less likely to be operative when an unexpected problem occurs?? [Unless one thinks of Arquillian being used for test only and thus mostly at high log levels???)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I'll add that

Copy link
Contributor

@hutchig hutchig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor comments only. Overall a good improvement IMHO.

@Azquelt Azquelt merged commit dfe1614 into OpenLiberty:master Jul 18, 2018
@Azquelt Azquelt deleted the improve-app-state-checking branch August 13, 2018 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants