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 #437

Closed
jorgefr opened this issue Oct 27, 2018 · 1 comment
Closed

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.
I reported the issue to the Spring boot project (spring-projects/spring-boot#14979) but I was redirected here.

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 (https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L858), but some lines before, the ApplicationFailedEvent was triggered (https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L828). 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.0 of spring-cloud and 2.0.3 of spring-boot.

@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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants