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

[Bug] Dubbo3.3.1 During the initialization process of AbstractServer, the doOpen() method publishes the uninitialized internal state to the external thread, resulting in: "this.dubboChannels" is null. #14848

Open
4 tasks done
rezar1 opened this issue Nov 2, 2024 · 0 comments
Assignees
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage

Comments

@rezar1
Copy link

rezar1 commented Nov 2, 2024

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

3.3.1

Steps to reproduce this issue

accidental
example:

public abstract class ServerSuper {
public ServerSuper() throws InterruptedException {
this.open();
}
public abstract void open();
}

public class ServerSub extends ServerSuper {

private static ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(100);

private final Object shouldNonNull = new Object();

public ServerSub() throws InterruptedException {
	super();
}

public static void main(String[] args) {
	IntStream
	.range(0, 10000)
	.forEach(index -> {
		try {
			new ServerSub();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	});
	newFixedThreadPool.shutdown();
}

@Override
public void open() {
	newFixedThreadPool
	.execute(() -> {
		if (shouldNonNull == null) {
			throw new IllegalStateException("shouldNonNull was null");
		}
	});
	try {
		TimeUnit.MILLISECONDS.sleep(RandomUtils.nextLong(0, 2));
	} catch (InterruptedException e) {
		e.printStackTrace();
	}
}

}

What you expected to happen

2024-11-02 11:50:08.268 [TID: N/A] �[35mNettyServerWorker-9-1�[m �[31mERROR�[m �[1;36mLog4j2Logger.java:126�[m - [DUBBO] Unexpected exception from downstream before protocol detected., dubbo version: 3.3.1, current host: , error code: 99-0. This may be caused by unknown error in remoting module, go to https://dubbo.apache.org/faq/99/0 to find instructions.
java.lang.NullPointerException: Cannot invoke "java.util.Map.put(Object, Object)" because "this.dubboChannels" is null
at org.apache.dubbo.remoting.transport.netty4.NettyChannelHandler.channelActive(NettyChannelHandler.java:52) ~[dubbo-3.3.1.jar!/:3.3.1]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:262) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:238) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelActive(AbstractChannelHandlerContext.java:231) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelActive(DefaultChannelPipeline.java:1398) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:258) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:238) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelActive(DefaultChannelPipeline.java:895) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:522) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[netty-common-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) ~[netty-common-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[netty-common-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) ~[netty-transport-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.87.Final.jar!/:4.1.87.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.87.Final.jar!/:4.1.87.Final]
at java.lang.Thread.run(Thread.java:840) ~[?:?]

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@rezar1 rezar1 added component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage labels Nov 2, 2024
@oxsean oxsean self-assigned this Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage
Projects
Status: Todo
Development

No branches or pull requests

2 participants