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

Update ChannelFactory.java #8746

Closed
wants to merge 1 commit into from
Closed

Conversation

davidgfolch
Copy link

Set shutdownGracefully quietPeriod & timeout as configurable parameters by properties wold be nice.

As described in the shutdownGracefully javadoc:

Signals this executor that the caller wants the executor to be shut down. Once this method is called, isShuttingDown() starts to return true, and the executor prepares to shut itself down. Unlike shutdown(), graceful shutdown ensures that no tasks are submitted for 'the quiet period' (usually a couple seconds) before it shuts itself down. If a task is submitted during the quiet period, it is guaranteed to be accepted and the quiet period will start over.

  • tomcat 8.5
  • java / spring-boot 2.2.6
  • infinispan-spring-boot-starter-remote:2.3.3.Final
  • hodrot client

The SpringRemoteCacheManager.stop() is calling nativeCacheManager.getChannelFactory.destory() but there are still some threads not closing on context undeployment:

06-Oct-2020 05:38:49.075 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ebo##000000013] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@508e050f]) and a value of type [io.netty.util.internal.InternalThreadLocalMap] (value [io.netty.util.internal.InternalThreadLocalMap@753fd803]) 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.

The tomcat context.xml undeployTimeout option seems to minimize the number of threads still hanged but they are still appearing.

Set shutdownGracefully quietPeriod & timeout as configurable parameters by properties wold be nice.

As described in the shutdownGracefully javadoc:
> Signals this executor that the caller wants the executor to be shut down. Once this method is called, isShuttingDown() starts to return true, and the executor prepares to shut itself down. Unlike shutdown(), graceful shutdown ensures that no tasks are submitted for 'the quiet period' (usually a couple seconds) before it shuts itself down. If a task is submitted during the quiet period, it is guaranteed to be accepted and the quiet period will start over.

- tomcat 8.5
- java / spring-boot 2.2.6
- infinispan-spring-boot-starter-remote:2.3.3.Final
- hodrot client

The SpringRemoteCacheManager.stop() is calling nativeCacheManager.getChannelFactory.destory() but there are still some threads not closing on context undeployment:

```
06-Oct-2020 05:38:49.075 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ebo#infinispan#13] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@508e050f]) and a value of type [io.netty.util.internal.InternalThreadLocalMap] (value [io.netty.util.internal.InternalThreadLocalMap@753fd803]) 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.
```
The tomcat context.xml undeployTimeout option seems to minimize the number of threads still hanged but they are still appearing.
@ghost
Copy link

ghost commented Oct 6, 2020

Can one of the admins verify this patch?

@ryanemerson
Copy link
Contributor

@davidgfolch Thank you for raising the issue. We normally use Jira to track issues/feature requests.

@karesti Any thoughts on the issue/suggestion?

@karesti
Copy link
Contributor

karesti commented Oct 14, 2020

@ryanemerson this is a deeper change asked discovered through spring boot. @danberindei WDYT ?

@karesti
Copy link
Contributor

karesti commented Oct 14, 2020

@davidgfolch Thanks for raising, I will open a JIRA after reading what @danberindei has to say about it!

@karesti karesti closed this Oct 14, 2020
@karesti
Copy link
Contributor

karesti commented Oct 14, 2020

(closed because it's a bug and/or feature request)

@davidgfolch
Copy link
Author

@davidgfolch Thanks for raising, I will open a JIRA after reading what @danberindei has to say about it!

Thank you, Can you please reference Jira issue to follow up?

@karesti
Copy link
Contributor

karesti commented Oct 15, 2020

@danberindei
Copy link
Member

@karesti this seems to be 2 different issues:

  1. Feature request: Add shutdownGracefully quietPeriod & timeout settings
  2. Bug: Tomcat complains that Netty added a ThreadLocal (InternalThreadLocalMap) to a Tomcat thread and didn't remove it on web application shutdown.

I'm not sure they are related, but in any case they will require much more than the title of this PR and ISPN-12434 suggest (Update ChannelFactory.java).

@karesti
Copy link
Contributor

karesti commented Oct 17, 2020

@danberindei yes, I do agree. I opened the issue only with the title of the PR and the link to it because TBH I was expecting you to lighting in this issue

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