question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pubSubHeathContributor timeout exception on SpringBoot 2.5.5 start up

See original GitHub issue

We are running on JDK 11 on Ubuntu and the app is a SpringBoot jar.

  <spring-boot.version>2.5.5</spring-boot.version>
        <spring-cloud-gcp.version>2.0.4</spring-cloud-gcp.version>
        <spring-cloud.version>2020.0.4</spring-cloud.version>
        <java.version>11</java.version>
2021-10-07 15:18:05.334 ERROR 3524350 --- [main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubHealthContributor' defined in class path resource [com/google/cloud/spring/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributor]: Factory method 'pubSubHealthContributor' threw exception; nested exception is org.springframework.beans.factory.BeanInitializationException: Validation of health indicator failed; nested exception is java.util.concurrent.TimeoutException
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318)
	at com.fastlane.billview.BillviewMainApplication.main(BillviewMainApplication.java:32)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributor]: Factory method 'pubSubHealthContributor' threw exception; nested exception is org.springframework.beans.factory.BeanInitializationException: Validation of health indicator failed; nested exception is java.util.concurrent.TimeoutException
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	... 28 common frames omitted
Caused by: org.springframework.beans.factory.BeanInitializationException: Validation of health indicator failed; nested exception is java.util.concurrent.TimeoutException
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.validationFailed(PubSubHealthIndicator.java:169)
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.doHealthCheck(PubSubHealthIndicator.java:139)
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.validateHealthCheck(PubSubHealthIndicator.java:106)
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicatorAutoConfiguration.createIndicator(PubSubHealthIndicatorAutoConfiguration.java:79)
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicatorAutoConfiguration.createIndicator(PubSubHealthIndicatorAutoConfiguration.java:49)
	at org.springframework.boot.actuate.autoconfigure.health.AbstractCompositeHealthContributorConfiguration.createContributor(AbstractCompositeHealthContributorConfiguration.java:54)
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicatorAutoConfiguration.pubSubHealthContributor(PubSubHealthIndicatorAutoConfiguration.java:69)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 29 common frames omitted
Caused by: java.util.concurrent.TimeoutException: null
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
	at org.springframework.util.concurrent.SettableListenableFuture.get(SettableListenableFuture.java:134)
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.pullMessage(PubSubHealthIndicator.java:148)
	at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.doHealthCheck(PubSubHealthIndicator.java:122)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
itsliangcommented, Nov 13, 2021
plugins {
    id 'org.springframework.boot' version '2.5.6'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

dependencyManagement {
    imports {
        mavenBom 'com.google.cloud:spring-cloud-gcp-dependencies:2.0.5'
    }
}

Worked on my Debian 10 Linux, JDK 11, spring.cloud.gcp.pubsub.health.timeout-millis=2000.

Failed on my macOS 10.15.7, JDK 11, spring.cloud.gcp.pubsub.health.timeout-millis=5000.

Worked on my macOS 10.15.7, JDK 11, spring.cloud.gcp.pubsub.health.timeout-millis=10000.

1reaction
elefeintcommented, Mar 9, 2022

Yes; we should not be preventing application startup on healthcheck failure, especially since we are seeing false positive failures. That’s a higher level decision that should be up to each individual application.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When trying to start my Spring Boot application, I get google ...
In IntelliJ, I'll run it and it will give me this error log. The last error says The Application Default Credentials are not...
Read more >
Common Application Properties - Spring
Name Description Default... spring.cassandra.config Location of the configuration file to use. spring.cassandra.controlconnection.timeout Timeout to use for control queries. 5s spring.cassandra.keyspace‑name Keyspace name to use.
Read more >
Hazelcast IMDG Release Notes
Cleaned up the noisy initial log messages on Hazelcast startups. ... registered error when using Spring Boot 1.4.2 and Hazelcast 3.7.x.
Read more >
151. Google Cloud Pub/Sub | Docs4dev
spring.cloud.gcp.pubsub.[subscriber,publisher].retry.max ...
Read more >
PubSubHealthIndicator (Spring Cloud GCP 3.4.0 API)
org.springframework.boot.actuate.health.AbstractHealthIndicator. com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found