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

secretmanager config import cause native image docker silently crash #2782

Open
czp3009 opened this issue Apr 12, 2024 · 1 comment
Open
Labels
priority: p2 type: bug Something isn't working

Comments

@czp3009
Copy link

czp3009 commented Apr 12, 2024

Describe the bug

Library used:

'org.springframework.boot' version '3.2.4'

'spring-cloud-gcp-starter-secretmanager', version: '5.1.2'

'org.graalvm.buildtools.native' version '0.10.1'

Get a application.yaml like this:

spring:
  config:
    import: sm://

With a minimal application entrypoint:

@SpringBootApplication
open class Application

fun main() {
    runApplication<Application>()
}

Then compile it to Graalvm native image docker and run

./gradlew bootBuildImage

docker run docker.io/library/spring-boot-gcp-secretmanager-native-image-crash:1.0-SNAPSHOT

The docker crashes as soon as it is executed, without any output

Extra attempts:

  1. If i remove spring.config.import in application.yaml, all things works well. So this problem only occurs when sm:// is used

  2. If i don't package the native image as docker, it works fine:

./gradlew nativeRun

OR:

./gradlew nativeCompile
./build/native/nativeCompile/spring-boot-gcp-secretmanager-native-image-crash

Maybe secretmanager is conflicting with something in spring boot docker?

  1. Whether or not i use sm://xxx on other properties to get the variable, it will crash as soon as i have spring.config.import. So i just provided a minimized example

Sample
See my repository: https://github.com/czp3009/spring-boot-gcp-secretmanager-native-image-crash

Please follow the README to build and run the docker to see what happen

@burkedavison burkedavison added type: bug Something isn't working priority: p2 labels Apr 12, 2024
@czp3009
Copy link
Author

czp3009 commented Apr 20, 2024

More findings: It seems docker is not crashed before Spring running. If i add a SpringApplicationRunListener to app and write some println() in the, it just print message successful.

So Spring does run successfully, but crashes when preparing the Environment. Since the logger is not available before preparing the Environment, there are not any logging

I don't know how to debug the graalvm native image program in docker, so that's all I know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants