Skip to content

Commit 790ec42

Browse files
authored
fix: command parsing and executing caused console dead lock (#1565)
### Motivation Executing a lot of commands while e.g. services are starting (printing messages to the console) can lead to dead locks. This issue was probably introduced with the cloud 2.0 migration. Prior to cloud 2.0 the framework used to run suggestions on the caller thread. With cloud 2.0 a shared thread pool for suggestion, parsing and executing can be used. This then leads to dead locks. ### Modification Explicitly set the thread pool for parsing & executing only. Suggestions are processed on the caller thread (thus restoring cloud 1.0 behavior. ### Result No dead-locks of the console.
1 parent 9389d89 commit 790ec42

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

checkstyle.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
<property name="ignorePattern" value="^package.*|^import.*|a href|http://|https://|ftp://|//.*"/>
3737
</module>
3838
<module name="TreeWalker">
39+
<property name="skipFileOnJavaParseException" value="true"/>
40+
<property name="javaParseExceptionSeverity" value="info"/>
3941
<module name="SuppressionCommentFilter">
4042
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
4143
<property name="onCommentFormat" value="CHECKSTYLE.ON"/>

node/src/main/java/eu/cloudnetservice/node/command/defaults/DefaultCommandManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ final class DefaultCommandManager extends CommandManager<CommandSource> {
3838
* a thread pool with 4 threads.
3939
*/
4040
private DefaultCommandManager() {
41+
var executor = Executors.newFixedThreadPool(4);
4142
super(
42-
ExecutionCoordinator.<CommandSource>builder().executor(Executors.newFixedThreadPool(4)).build(),
43+
ExecutionCoordinator.<CommandSource>builder()
44+
.parsingExecutor(executor)
45+
.executionSchedulingExecutor(executor)
46+
.build(),
4347
CommandRegistrationHandler.nullCommandRegistrationHandler());
4448
this.registerCapability(CloudCapability.StandardCapabilities.ROOT_COMMAND_DELETION);
4549
}

0 commit comments

Comments
 (0)