8000 Clean shutdown not possible. · Issue #319 · dnsjava/dnsjava · GitHub
[go: up one dir, main page]

Skip to content
Clean shutdown not possible. #319
Closed
Closed
Copy link
@enexusde

Description

@enexusde

Using Tomcat I try to shutdown the DNS-Thread.

Using this code:

package de.e_nexus.web.rm.mail.veto.dnsbl;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.annotation.PreDestroy;
import javax.inject.Named;

import org.xbill.DNS.NioClient;

@Named
public class DNSThreadStopper {

	public static final Logger LOG = Logger.getLogger(DNSThreadStopper.class.getCanonicalName());

	@PreDestroy
	public void stopDNSThreads() {
		LOG.info("Stopping thread [dnsjava NIO selector] in order to clean shutdown.");
		try {
			NioClient.close();
			LOG.info("Finished thread [dnsjava NIO selector], clean shutdown possible now.");
		} catch (Exception e) {
			LOG.log(Level.SEVERE, "Could not shutdown [dnsjava NIO selector]!", e);
		}
	}
}

This is the Stacktrace:

java.lang.NullPointerException: Cannot invoke "java.nio.channels.Selector.wakeup()" because "org.xbill.DNS.NioClient.selector" is null
	at org.xbill.DNS.NioClient.close(NioClient.java:89)
	at org.xbill.DNS.NioClient.close(NioClient.java:67)
	at de.e_nexus.web.rm.mail.veto.dnsbl.DNSThreadStopper.stopDNSThreads(DNSThreadStopper.java:29)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
31-Mar-2024 08:23:50.761 WARNUNG [http-nio-8080-exec-25] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [dnsjava NIO selector] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.base@17.0.6/sun.nio.ch.EPoll.wait(Native Method)
 java.base@17.0.6/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:118)
 java.base@17.0.6/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:129)
 java.base@17.0.6/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:141)
 org.xbill.DNS.NioClient.runSelector(NioClient.java:113)
 org.xbill.DNS.NioClient$$Lambda$5994/0x0000000807912710.run(Unknown Source)
 java.base@17.0.6/java.lang.Thread.run(Thread.java:833)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0