The reason for the problem is that because netty is closed asynchronously, after the tomcat servlet is closed, netty has not actually been closed, so this error occurs. Just set netty to sync off. But now there is still a warning when synchronization is turned off:
严重 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [electric] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@6c9a20a]) and a value of type [io.netty.util.internal.InternalThreadLocalMap] (value [io.netty.util.internal.InternalThreadLocalMap@59404c7b]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
In fact, this problem can be ignored. I have encountered this problem. The answers I found at that time were:
https://github.com/relayrides...
https://github.com/netty/nett...
Mine is a Spring program, and a SmartLifecycle is registered, which is called when the program stops:
If you are a Servlet, you should have a similar Listener. Just do this in the Listener.
If you access illegally, check whether the permissions of your tomcat are open
The reason for the problem is that because netty is closed asynchronously, after the tomcat servlet is closed, netty has not actually been closed, so this error occurs. Just set netty to sync off. But now there is still a warning when synchronization is turned off:
I don’t know where to start. . .