zrlw edited a comment on issue #9283: URL: https://github.com/apache/dubbo/issues/9283#issuecomment-971427659
过去两天尝试了下列修订(失败告终): 1. 构建InstanceAddressURL时,注册rpc ServiceContext销毁通知方法到当前线程的rpcContext; 2. 在RpcContext销毁SERVICE_CONTEXT时,调用已注册的销毁通知方法通知InstanceAddressURL采用强引用方式保存RpcServiceContext以便能够继续访问RpcServiceContext的成员属性; 3. 修改InstanceAddressURL获取ServiceContext的相关方法:如有保存的ServiceContext,而且保存的ServiceContext的consumerUrl的scope model为destroyed状态或着RpcContext的ServiceContext里的consumerUrl为null,则使用保存的ServiceContext,其他情况下均使用RpcContext的ServiceContext。 验证测试类:SpringXmlConfigTest 本地windows采取上述方式测试验证没有什么问题,但github构建99%的概率两个ubuntu单元测试失败,手头没有ubuntu环境,只好加了很多logger部署到github上排查原因,最终确认ubuntu环境下构建InstanceAddressURL的线程往往是main-EventThread,但是使用InstanceAddressURL对象的线程往往是main线程,main线程感知不到注册到main-EventThread线程的rpc ServiceContext销毁通知方法,销毁时没有调用销毁通知方法。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
