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

Client not shutting down all threads #516

Open
TheWizz opened this issue Jul 24, 2024 · 0 comments
Open

Client not shutting down all threads #516

TheWizz opened this issue Jul 24, 2024 · 0 comments

Comments

@TheWizz
Copy link

TheWizz commented Jul 24, 2024

I'm trying to do a graceful shutdown of com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient, but have some threads that seem to not bing shut down. I attempt to shut down by calling disconnect() on my single Mqtt3AsyncClient.

Expected behavior

All threads spawned by Mqtt3AsyncClient what aren't daemon threads to be shut down automatically after disconnecting the client.

Actual behavior

I'm seeing this non-daemon thread remaining indefinitely:

"com.hivemq.client.mqtt-2-1@17300" prio=10 tid=0x42 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.KQueue.poll(KQueue.java:-1)
at sun.nio.ch.KQueueSelectorImpl.doSelect(KQueueSelectorImpl.java:122)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
- locked <0x4bd6> (a sun.nio.ch.KQueueSelectorImpl)
- locked <0x4bd7> (a io.netty.channel.nio.SelectedSelectionKeySet)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
at io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)
at io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:883)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:526)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:829)

To Reproduce

Run the Mqtt3AsyncClient with a clean session configured like this:

		Mqtt3ClientBuilder clientBuilder = MqttClient.builder()
			.identifier(mMyIdentifier)
			.serverHost(settings.getAddress())
			.serverPort(settings.getPort())
			.addConnectedListener(this)
			.addDisconnectedListener(this)
			.automaticReconnectWithDefaultConfig()
			.useMqttVersion3();
  • Affected HiveMQ CE version(s): hivemq-mqtt-client 1.3.3
  • Used JVM version: Java 11

Is there some other method to make it shut down properly?

Mike

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant