You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Thomas (JIRA)" <ji...@apache.org> on 2016/11/04 09:58:58 UTC

[jira] [Resolved] (DAEMON-333) Stop abusing System.gc() on Commons Daemon jsvc shutdown

     [ https://issues.apache.org/jira/browse/DAEMON-333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved DAEMON-333.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 1.1

One small correction to this report:
GC time is proportional to the size of the live objects on the heap, not the size of the GC'able objects.

I suspect the calls to explicit GC date back to when the automatic GC was not as reliable as it is now. I agree there should be no need for those calls. I have removed them.

> Stop abusing System.gc() on Commons Daemon jsvc shutdown
> --------------------------------------------------------
>
>                 Key: DAEMON-333
>                 URL: https://issues.apache.org/jira/browse/DAEMON-333
>             Project: Commons Daemon
>          Issue Type: Bug
>          Components: Jsvc
>    Affects Versions: 1.0.15
>            Reporter: Manuel Dominguez Sarmiento
>             Fix For: 1.1
>
>
> The shutdown sequence invokes System.gc() several times. I'm not sure why this would be necessary, especially considering that System.gc() is only a hint and the JVM will not necessarily do anything when this method is invoked. Especially if -XX:+DisableExplicitGC is used, which is fairly common practice in production environments.
> In our case, we use rather huge heaps (over 100 GB) so shutdown can take forever, depending on how much uncollected garbage there is in the JVM heap. We've always used -XX:+DisableExplicitGC so this was never apparent, however we decided to stop using -XX:+DisableExplicitGC after careful code review showed none of our apps or supporting libraries are using System.gc() and sometimes we want to trigger GC manually from monitoring tools (Jconsole, VisualVM, etc.) - but we found the hard way that Commons Daemon / jsvc is using System.gc() on shutdown, preventing the speedy shutdown we were used to.
> Re-introducing XX:+DisableExplicitGC fixes the problem, and shutdown is back to normal, takes less than 8 seconds on our hardware.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)