a4363220 opened a new issue, #11876:
URL: https://github.com/apache/dubbo/issues/11876

   system:centos7.9
   jdk:11
   dubbo:3.1.4
   序列化:kryo1.0.1
   问题:在消费者透传信息给提供者时,在提供者的方法第一行是可以获取到透传信息,但是在方法执行期间和执行末尾获取透传信息则为空,但是相同的案例 
我把dubbo版本切回到3.1.0版本则一切正常,不太理解是因为什么原因造成的,还是官方已经得知该问题并修复了。
   
   提供者代码如下:
       @Override
       public PageVo<QuerySysUserByPageVo> querySysUserByPage(PageDto pageDto, 
QuerySysUserByPageDto dto) {
           log.info("查询用户分页开始:{}",AdminRpcContext.getUser());
           // 统计
           Integer totalRowSize = userMapper.querySysUserByCount(dto);
           if (totalRowSize == 0) return null;
           // 计算分页
           PageOperationResultBo page = 
PageOperationTools.operationPage(pageDto, totalRowSize);
           // 查询分页结果
           List<QuerySysUserByPageVo> voList = 
userMapper.querySysUserByPage(page, dto);
           // 填充角色以及岗位
           voList.forEach(vo -> {
               
vo.setRolesVo(userRoleMapper.querySysRolePersonalInfoList(vo.getId()));
               
vo.setPostsVo(userPostMapper.querySysPostPersonalInfoList(vo.getId()));
           });
           log.info("查询用户分页完成:{}",AdminRpcContext.getUser());
           return PageVo.build(page, voList);
       }
   
   **3.1.4版本获取rpc透传信息大致打印如下:**
   
   2023-03-21 15:04:03.038 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.user.service.service.sys.SysUserServiceImp - 查询用户分页开始:AdminUserBo(id=1)
   2023-03-21 15:04:03.038 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:04:03.055 [DubboServerHandler-172.18.0.1:20100-thread-6] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:04:04.039 [DubboServerHandler-172.18.0.1:20100-thread-6] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:04:04.042 [DubboServerHandler-172.18.0.1:20100-thread-6] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:04:04.042 [DubboServerHandler-172.18.0.1:20100-thread-6] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:04:04.049 [DubboServerHandler-172.18.0.1:20100-thread-6] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:04:04.081 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.s.core.mybatis.hanlder.MybatisQueryHandler - 旧sql:[1],数据权限:select count(*)
   2023-03-21 15:04:04.200 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:null
   2023-03-21 15:04:04.211 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:null
   2023-03-21 15:04:04.215 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, 
lock=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.LockSegment@4233467d],
 window=Optional.empty)
   2023-03-21 15:04:04.215 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:04:04.220 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:null
   2023-03-21 15:04:04.221 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:04:04.221 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:04:04.225 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:null
   2023-03-21 15:04:04.226 [DubboServerHandler-172.18.0.1:20100-thread-7] INFO  
ShardingSphere-SQL - Logic SQL: select
   
   2023-03-21 15:04:04.281 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:04:04.288 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:null
   2023-03-21 15:04:04.318 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:04:04.318 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:04:04.324 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:null
   2023-03-21 15:04:04.369 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.user.service.service.sys.SysUserServiceImp - 查询用户分页完成:null
   
   **3.1.0版本获取rpc透传信息大致打印如下:**
   
   2023-03-21 15:08:07.774 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
c.l.p.user.service.service.sys.SysUserServiceImp - 查询用户分页开始:AdminUserBo(id=1)
   2023-03-21 15:08:07.790 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:08:07.842 [DubboServerHandler-172.18.0.1:20100-thread-4] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:08:08.749 [DubboServerHandler-172.18.0.1:20100-thread-4] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:08:08.749 [DubboServerHandler-172.18.0.1:20100-thread-4] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:08.900 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - Logic SQL: SELECT count(*) FROM sys_user WHERE id = ? AND 
create_user_id IN (1)
   2023-03-21 15:08:08.900 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:08:08.900 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:08.907 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:08:08.922 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:08:08.926 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, 
lock=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.LockSegment@5d9c13de],
 window=Optional.empty)
   2023-03-21 15:08:08.926 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:08.930 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:08:08.931 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:08:08.931 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:08.935 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:08:08.935 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:08:08.935 [DubboServerHandler-172.18.0.1:20100-thread-5] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:09.046 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - Logic SQL: SELECT users.id, users.dept_id, dept.name AS 
deptName, users.username, users.nickname, users.status, users.update_user_id, 
users.update_time, users.create_user_id, users.create_time FROM sys_user AS 
users LEFT JOIN sys_dept AS dept ON users.dept_id = dept.id WHERE users.id = ? 
AND users.create_user_id IN (1) ORDER BY users.id DESC LIMIT ?, ?
   2023-03-21 15:08:09.046 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dml.pagination.limit.LimitSegment@1919f13b],
 lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:08:09.046 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:09.052 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 拦截器获取:AdminUserBo(id=1)
   2023-03-21 15:08:09.090 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:08:09.091 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:09.095 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
c.l.p.service.core.mybatis.MybatisInterceptor - 
拦截器获取:AdminUserBo(id=1)erPost.post_id = post.id
   2023-03-21 15:08:09.098 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(table=Optional.empty, 
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   2023-03-21 15:08:09.098 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
ShardingSphere-SQL - Actual SQL(simple): [master_0] ::: 1
   2023-03-21 15:08:09.102 [DubboServerHandler-172.18.0.1:20100-thread-3] INFO  
c.l.p.user.service.service.sys.SysUserServiceImp - 查询用户分页完成:AdminUserBo(id=1)
   
   可以看到在3.1.0版本上从方法执行到末尾都可以正常拿到RpcContext参数


-- 
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]

Reply via email to