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

spring-cloud application shuts down silently after exception during startup #14979

Closed
jorgefr opened this issue Oct 27, 2018 · 2 comments
Closed
Labels
for: external-project For an external project and not something we can fix

Comments

@jorgefr
Copy link

jorgefr commented Oct 27, 2018

Hi, I found a situation in which an exception interrupts the startup of the application, the SpringApplication class tries to log the error, but it doesn't get written, since the SLF4JBridgeHandler handler was already removed from the root logger.

After discovering it, I found another issue reported where the cause seems to be the same: #9457. But in the case I'm describing, the solution seems to be simple, just moving the log instruction some lines above.

I found at least 2 cases when this is happening for me:
I have a spring cloud application that tries to decrypt secrets from the yaml files by using aws-kms. If the KMS client is not able to contact the service, it throws an exception:

Cannot decrypt: key=oauth2.clientSecret
Caused by com.amazonaws.services.kms.model.AWSKMSException: The security token included in the request is expired (Service: AWSKMS; Status Code: 400; Error Code: ExpiredTokenException; Request ID: 5033cffe-34a0-4118-986c-8e11aba3b5d3)

A similar thing happens when the secret starts with {cipher} but the value is not wrapped with quotes.

In both cases, the exception is captured by SpringApplication, which tries to log it, but some lines before, the ApplicationFailedEvent was triggered. And one of the listeners triggers a call to org.springframework.cloud.bootstrap.LoggingSystemShutdownListener, that removes the SLF4JBridgeHandler from the root Logger.

I am using version 2.0.3 of spring-boot.

@philwebb
Copy link
Member

I think this is an issue that needs to be resolved in Spring Cloud. It seems like LoggingSystemShutdownListener is perhaps listening to the wrong event. If you're able to create a sample application without Spring Cloud in the mix then please attach it here and we'll re-open this issue. Otherwise, could you please report this with the Spring Cloud team here.

@philwebb philwebb added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 27, 2018
@jorgefr jorgefr changed the title Spring application shuts down silently after exception during startup spring-cloud application shuts down silently after exception during startup Oct 27, 2018
@jorgefr
Copy link
Author

jorgefr commented Oct 27, 2018

After all the investigation, it looks like excluding logging-commons from spring-cloud-stream-binder-kinesis solved the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

3 participants