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

Question about ClientManager in Nacos 2.0.0 alpha2 #4788

Closed
catcherwong opened this issue Jan 23, 2021 · 5 comments · Fixed by #4815
Closed

Question about ClientManager in Nacos 2.0.0 alpha2 #4788

catcherwong opened this issue Jan 23, 2021 · 5 comments · Fixed by #4815
Labels
kind/bug Category issues or prs related to bug. version/2.x

Comments

@catcherwong
Copy link
Contributor

catcherwong commented Jan 23, 2021

Describe the bug

After upgrading from alpha1 to alpha2, the registration instance of the naming module is unsuccessful.

When debugging, it is found that when ClientManagerDelegate obtains ClientManager, it obtains ephemeralIpPortClientManager, but the number of clients in it is 0, and only the connectionBasedClientManager has a corresponding client.

As a result, the obtained client is null, which leads to a null pointer.


从alpha1升级到alpha2之后,naming 模块注册实例不成功。

调试的时候发现ClientManagerDelegate在获取ClientManager时,获取到的是ephemeralIpPortClientManager,但是它里面的client数量为0,只有connectionBasedClientManager里面才有对应的client。

导致获取到的client为null,从而引发空指针。

private ClientManager getClientManagerById(String clientId) {
if (isConnectionBasedClient(clientId)) {
return connectionBasedClientManager;
}
return clientId.endsWith("false") ? persistentIpPortClientManager : ephemeralIpPortClientManager;

image

remote-digest.log 部分日志如下

2021-01-23 11:59:22,465 INFO Connection transportReady,connectionId = 1611374362465_0:0:0:0:0:0:0:1_60957 

2021-01-23 11:59:22,500 DEBUG [grpc]  server check request receive ,clientIp : 0:0:0:0:0:0:0:1 

2021-01-23 11:59:29,749 ERROR [grpc] fail to handle request ,error message :null

java.lang.NullPointerException: null
	at com.alibaba.nacos.naming.core.v2.service.impl.EphemeralClientOperationServiceImpl.registerInstance(EphemeralClientOperationServiceImpl.java:53)
	at com.alibaba.nacos.naming.remote.rpc.handler.InstanceRequestHandler.registerInstance(InstanceRequestHandler.java:63)
	at com.alibaba.nacos.naming.remote.rpc.handler.InstanceRequestHandler.handle(InstanceRequestHandler.java:53)
	at com.alibaba.nacos.naming.remote.rpc.handler.InstanceRequestHandler.handle(InstanceRequestHandler.java:37)
	at com.alibaba.nacos.core.remote.RequestHandler.handleRequest(RequestHandler.java:52)
	at com.alibaba.nacos.core.remote.grpc.GrpcRequestAcceptor.request(GrpcRequestAcceptor.java:88)
	at com.alibaba.nacos.core.remote.grpc.BaseGrpcServer.lambda$addServices$0(BaseGrpcServer.java:166)
	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:172)
	at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
	at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
	at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
	at io.grpc.Contexts$ContextualizedServerCallListener.onHalfClose(Contexts.java:86)
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:331)
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:814)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Expected behavior

Acutally behavior

How to Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Desktop (please complete the following information):

  • OS: Windows
  • Version nacos-server 2.0.0 alpha2
  • Module naming
  • SDK nacos-sdk-csharp

Additional context

@catcherwong
Copy link
Contributor Author

This also has a great influence on the conn_id generated by the server

alpha2 use timestamp remote ip and remote port

.set(TRANS_KEY_CONN_ID, System.currentTimeMillis() + "_" + remoteIp + "_" + remotePort)

alpha1 use Uuid

.set(TRANS_KEY_CONN_ID, UuidUtils.generateUuid()).set(TRANS_KEY_CLIENT_IP, remoteIp)

@KomachiSion
Copy link
Collaborator

KomachiSion commented Jan 25, 2021

2.0.0还处于ALPHA阶段, 有些接口和内容可能会发生更改,请以最新版本为准。

Now 2.0.0 is ALPHA phase, there may be some changes for API and contents, Please use newest version.

@KomachiSion KomachiSion added status/invalid This doesn't seem right kind/bug Category issues or prs related to bug. and removed status/invalid This doesn't seem right labels Jan 25, 2021
@KomachiSion
Copy link
Collaborator

如果是ipv6的话,好像客户端id有问题。

@catcherwong
Copy link
Contributor Author

是的,说的是IPV6这个问题。

应该是getClientManagerById这里的判断需要调整一下。

@catcherwong
Copy link
Contributor Author

It works now.

可以了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Category issues or prs related to bug. version/2.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants