Node failed due to this tripped assertion:

```
» [2023-01-05T11:31:20,059][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [v8.6.0-0] fatal error in thread [Thread-17], exiting java.lang.AssertionError: Thread pool size [4] should be a multiple of 3. Num contexts = [1]
»  	at org.elasticsearch.xpack.ml.inference.deployment.DeploymentManager.infer(DeploymentManager.java:267)
»  	at org.elasticsearch.xpack.ml.inference.assignment.TrainedModelAssignmentNodeService.infer(TrainedModelAssignmentNodeService.java:283)
»  	at org.elasticsearch.xpack.ml.inference.deployment.TrainedModelDeploymentTask.infer(TrainedModelDeploymentTask.java:156)
»  	at org.elasticsearch.xpack.ml.action.TransportInferTrainedModelDeploymentAction.taskOperation(TransportInferTrainedModelDeploymentAction.java:167)
»  	at org.elasticsearch.xpack.ml.action.TransportInferTrainedModelDeploymentAction.taskOperation(TransportInferTrainedModelDeploymentAction.java:43)
»  	at org.elasticsearch.server@8.7.0-SNAPSHOT/org.elasticsearch.action.support.tasks.TransportTasksAction.nodeOperation(TransportTasksAction.java:138)
»  	at org.elasticsearch.server@8.7.0-SNAPSHOT/org.elasticsearch.action.support.tasks.TransportTasksAction$NodeTransportHandler.messageReceived(TransportTasksAction.java:331)
»  	at org.elasticsearch.server@8.7.0-SNAPSHOT/org.elasticsearch.action.support.tasks.TransportTasksAction$NodeTransportHandler.messageReceived(TransportTasksAction.java:327)
»  	at org.elasticsearch.security@8.7.0-SNAPSHOT/org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$1.doRun(SecurityServerTransportInterceptor.java:494)
»  	at org.elasticsearch.server@8.7.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
»  	at org.elasticsearch.security@8.7.0-SNAPSHOT/org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$2.onResponse(SecurityServerTransportInterceptor.java:541)
```

**Build scan:**
https://gradle-enterprise.elastic.co/s/nlt5lvxv2kgfu/tests/:x-pack:qa:rolling-upgrade:v8.6.0%23upgradedClusterTest/org.elasticsearch.upgrades.MLModelDeploymentsUpgradeIT/testTrainedModelDeployment

**Reproduction line:**
```
./gradlew ':x-pack:qa:rolling-upgrade:v8.6.0#upgradedClusterTest' -Dtests.class="org.elasticsearch.upgrades.MLModelDeploymentsUpgradeIT" -Dtests.method="testTrainedModelDeployment" -Dtests.seed=9F03B6EB70A67EB9 -Dtests.bwc=true -Dtests.locale=ja -Dtests.timezone=Asia/Pyongyang -Druntime.java=17
```

**Applicable branches:**
main

**Reproduces locally?:**
Didn't try

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.upgrades.MLModelDeploymentsUpgradeIT&tests.test=testTrainedModelDeployment

**Failure excerpt:**
```
org.elasticsearch.client.ResponseException: method [POST], host [http://127.0.0.1:40713], URI [/_ml/trained_models/upgrade-deployment-test/deployment/_infer], status line [HTTP/1.1 500 Internal Server Error]
Warnings: [[POST /_ml/trained_models/{model_id}/deployment/_infer] is deprecated! Use [POST /_ml/trained_models/{model_id}/_infer] instead.]
{"error":{"root_cause":[{"type":"node_disconnected_exception","reason":"[v8.6.0-0][127.0.0.1:39179][cluster:monitor/xpack/ml/trained_models/deployment/infer[n]] disconnected"}],"type":"failed_node_exception","reason":"Failed node [c4_UHnAIRA2YMknDGQbKCg]","node_id":"c4_UHnAIRA2YMknDGQbKCg","caused_by":{"type":"node_disconnected_exception","reason":"[v8.6.0-0][127.0.0.1:39179][cluster:monitor/xpack/ml/trained_models/deployment/infer[n]] disconnected"}},"status":500}

  at __randomizedtesting.SeedInfo.seed([9F03B6EB70A67EB9:64DBF0B45166C42E]:0)
  at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:347)
  at org.elasticsearch.client.RestClient.performRequest(RestClient.java:313)
  at org.elasticsearch.client.RestClient.performRequest(RestClient.java:288)
  at org.elasticsearch.upgrades.MLModelDeploymentsUpgradeIT.infer(MLModelDeploymentsUpgradeIT.java:284)
  at org.elasticsearch.upgrades.MLModelDeploymentsUpgradeIT.assertInfer(MLModelDeploymentsUpgradeIT.java:184)
  at org.elasticsearch.upgrades.MLModelDeploymentsUpgradeIT.testTrainedModelDeployment(MLModelDeploymentsUpgradeIT.java:127)
  at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
  at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
  at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:568)
  at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1758)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:946)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:982)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:996)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.tests.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:44)
  at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
  at org.apache.lucene.tests.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:45)
  at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
  at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:390)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:843)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:490)
  at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:955)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:840)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:891)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:902)
  at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.tests.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:38)
  at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
  at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.tests.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
  at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
  at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
  at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
  at org.apache.lucene.tests.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:47)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:390)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl.lambda$forkTimeoutingTask$0(ThreadLeakControl.java:850)
  at java.lang.Thread.run(Thread.java:833)

```
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/deployment/DeploymentManager.java
var processContext = getProcessContext(task, listener::onFailure);
        if (processContext == null) {
            
            return;
        }
        final long requestId = requestIdCounter.getAndIncrement();
        InferencePyTorchAction inferenceAction = new InferencePyTorchAction(
            task.getModelId(),
            requestId,
            timeout,
            processContext,
            config,
            input,
            threadPool,
            parentActionTask,
            listener
        );
        PriorityProcessWorkerExecutorService.RequestPriority priority = skipQueue
            ? PriorityProcessWorkerExecutorService.RequestPriority.HIGH
            : PriorityProcessWorkerExecutorService.RequestPriority.NORMAL;
        executePyTorchAction(processContext, priority, inferenceAction);
    }
    public void updateNumAllocations(
        TrainedModelDeploymentTask task,
        int numAllocationThreads,
        TimeValue timeout,
        ActionListener<ThreadSettings> listener
    ) {
        var processContext = getProcessContext(task, listener::onFailure);
        if (processContext == null) {