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

Fix thread pool configuration is invalid #11543

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SHARED_EXECUTOR_SERVICE_COMPONENT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_EXPORT_THREAD_NUM;
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_PROTOCOL;
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_REFER_THREAD_NUM;
Expand Down Expand Up @@ -140,9 +141,21 @@ private ExecutorService createExecutor(URL url) {
return (ExecutorService) extensionAccessor.getExtensionLoader(ThreadPool.class).getAdaptiveExtension().getExecutor(url);
}

private Map<Integer, ExecutorService> getExecutors(URL url) {
Map<Integer, ExecutorService> executors;
// if it's on the provider side and has user-defined services, use biz service executor first, avoid using internal executor
if (PROVIDER_SIDE.equalsIgnoreCase(url.getParameter(SIDE_KEY))
&& data.containsKey(EXECUTOR_SERVICE_COMPONENT_KEY)) {
executors = data.get(EXECUTOR_SERVICE_COMPONENT_KEY);
} else {
executors = data.get(getExecutorKey(url));
}
return executors;
}

Comment on lines +144 to +155
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question that why ServiceDescriptor serviceDescriptor = applicationModel.getInternalModule().getServiceRepository().lookupService(url.getServiceInterface()); not work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because url.getServiceInterface() always returns MetadataService, when the MetadataService is first loaded.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The PortUnificationExchanger#reset method will return a new url instead of updating, so the Map in AbstractPortUnificationServer#supportedUrls will not be changed.

image

in NettyPortUnificationServerHandler#decode , localUrl is set by the value in urlMapper, not the updated url

image

So the url is still MetadataService.

@Override
public ExecutorService getExecutor(URL url) {
Map<Integer, ExecutorService> executors = data.get(getExecutorKey(url));
Map<Integer, ExecutorService> executors = getExecutors(url);

/*
* It's guaranteed that this method is called after {@link #createExecutorIfAbsent(URL)}, so data should already
Expand Down