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状态,则使用保存的ServiceContext,否则使用RpcContext的ServiceContext。 验证测试类:SpringXmlConfigTest 本地windows采取上述方式测试验证没有什么问题,但github构建99%的概率两个ubuntu单元测试失败,手头没有ubuntu环境,只好加了很多logger部署到github上排查原因,最终确认ubuntu环境下构建InstanceAddressURL的线程往往是main-EventThread,但是使用InstanceAddressURL对象的线程往往是main线程,main线程感知不到注册到main-EventThread线程的rpc ServiceContext销毁通知方法。 我深度怀疑同一个InstanceAddressURL对象的getServiceContext方法可能也会被多个线程调用,所以放弃了这种注册通知的修复方式。 -- 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]
