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

Readiness check will fail when use SOFAArk #385

Closed
straybirdzls opened this issue Apr 12, 2019 · 1 comment
Closed

Readiness check will fail when use SOFAArk #385

straybirdzls opened this issue Apr 12, 2019 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@straybirdzls
Copy link
Member

straybirdzls commented Apr 12, 2019

call stack

2019-04-12 21:53:36,526 ERROR main                             - Error occurred while doing HealthIndicatorclass com.alipay.sofa.runtime.spring.health.MultiApplicationHealthIndicator readiness check.
java.lang.IllegalArgumentException: App is still in startup process, please try later!
	at org.springframework.util.Assert.isTrue(Assert.java:92) ~[spring-core-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at com.alipay.sofa.healthcheck.service.SofaBootHealthIndicator.health(SofaBootHealthIndicator.java:49) ~[healthcheck-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.runtime.spring.health.DefaultRuntimeHealthChecker.isHealth(DefaultRuntimeHealthChecker.java:54) ~[runtime-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager.isHealthCheckPassed(StandardSofaRuntimeManager.java:68) ~[runtime-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.runtime.spring.health.MultiApplicationHealthIndicator.health(MultiApplicationHealthIndicator.java:36) ~[runtime-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.healthcheck.core.HealthIndicatorProcessor.doHealthCheck(HealthIndicatorProcessor.java:107) [healthcheck-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.healthcheck.core.HealthIndicatorProcessor.readinessHealthCheck(HealthIndicatorProcessor.java:90) [healthcheck-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.healthcheck.startup.ReadinessCheckListener.readinessHealthCheck(ReadinessCheckListener.java:127) [healthcheck-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.healthcheck.startup.ReadinessCheckListener.onApplicationEvent(ReadinessCheckListener.java:98) [healthcheck-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at com.alipay.sofa.healthcheck.startup.ReadinessCheckListener.onApplicationEvent(ReadinessCheckListener.java:43) [healthcheck-sofa-boot-starter-2.6.1.jar!/:2.6.1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) [spring-context-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) [spring-context-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) [spring-context-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) [spring-context-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.16.RELEASE.jar!/:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.16.RELEASE.jar!/:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.16.RELEASE.jar!/:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.16.RELEASE.jar!/:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.16.RELEASE.jar!/:1.5.16.RELEASE]

In previous scenario, we think that SofaBootHealthIndicator should only be called in liveness check:

  public boolean readinessHealthCheck(Map<String, Health> healthMap) {
        Assert.notNull(healthIndicators, "HealthIndicators must not be null.");

        logger.info("Begin SOFABoot HealthIndicator readiness check.");
        boolean result = true;
        for (String beanId : healthIndicators.keySet()) {
            if (healthIndicators.get(beanId) instanceof SofaBootHealthIndicator) {
                continue;
            }
            result = doHealthCheck(beanId, healthIndicators.get(beanId), healthMap) && result;
        }
        if (result) {
            logger.info("SOFABoot HealthIndicator readiness check result: success.");
        } else {
            logger.error("SOFABoot HealthIndicator readiness check result: failed.");
        }
        return result;
    }

However in ark scenario, MultiApplicationHealthIndicator will call SofaBootHealthIndicator...

@QilongZhang QilongZhang added the bug Something isn't working label Apr 13, 2019
@QilongZhang QilongZhang added this to the 3.1.4 milestone Apr 13, 2019
@straybirdzls
Copy link
Member Author

For more backgroud, can refer to #313

QilongZhang added a commit to QilongZhang/sofa-boot that referenced this issue May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants