java-slack-sdk icon indicating copy to clipboard operation
java-slack-sdk copied to clipboard

5 threads (for the default singleton) can be created even when SlackConfig#statsEnabled is false

Open seratch opened this issue 3 years ago • 2 comments

Developers can disable API clients' metrics management by setting SlackConfig#statsEnabled to false. Even in this case, the default SlackConfig object creation (as a static field in the class) starts 5 threads and those threads are unused. See the repro steps below for details.

Reproducible in:

any versions

The Slack SDK version

any versions

Java Runtime version

any versions

OS info

any versions

Steps to reproduce:

Running the following code and checking the thread dump.

SlackConfig config = new SlackConfig();
config.setStatsEnabled(false);
Slack slack = Slack.getInstance(config);

Expected result:

No threads under a "slack-api-metrics" thread group are created.

Actual result:

5 threads for the default singleton SlackConfig instance are created.

seratch avatar May 19 '22 21:05 seratch

Also running into this issue. I'm working on a slack app using Quarkus, where I hope the native compilation will allow the app to start up fast enough for the 3-second limit on processing the Events API.

Running native compilation requires exclusion of these default classes because of the threads started (which Quarkus doesn't allow)

jfbenckhuijsen avatar Jul 14 '22 07:07 jfbenckhuijsen

@jfbenckhuijsen Thanks for sharing this. However, even when this issue is resolved, this SDK still does not support native builds. Refer to https://github.com/slackapi/java-slack-sdk/issues/1009 for more details. We are not planning to add native supports as long as gson project is ready for it.

seratch avatar Jul 14 '22 07:07 seratch