apache / servicecomb-service-center

A standalone service center to allow services to register their instance information and to discover providers of a given service
Apache License 2.0
1.34k stars 342 forks source link

实例主动下线,向SC发起unregister 返回 400017, leaseId not exist #1407

Open healer1219 opened 1 year ago

healer1219 commented 1 year ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. springcloud huawei 1.8.0 hoxton

    @Component
    public class Unregister implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    private ServiceCombRegistration serviceCombRegistration;
    
    @Autowired
    private ServiceCombServiceRegistry serviceCombServiceRegistry;
    
    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        Runtime.getRuntime().addShutdownHook(
                new Thread(() -> {
                    serviceCombServiceRegistry.deregister(serviceCombRegistration);
                })
        );
    }
    }
  2. kill 这个实例

Expected behavior 服务主动调用unregister后应能正常清除实例

Platform And Runtime (please complete the following information):

Platform

Runtime

little-cui commented 1 year ago

出现这个错误,表示实例已经下线,可以确认下配置的实例心跳间隔