Bug 923400 - Sigar creates high number of blocked threads (unbounded) if mount is gone

Thomas Segismont tsegismo at redhat.com
Wed Jul 3 12:12:27 UTC 2013


One additional change may be to set a limit for the number of on demand 
Sigar instances and reject calls when this limit is reached.


Le 03/07/2013 12:39, Thomas Segismont a écrit :
> Hi,
>
> I've worked on a fix for Bug 923400 - Sigar creates high number of
> blocked threads (unbounded) if mount is gone.
>
> The problem is that we use a shared instance of Sigar and threads may be
> blocked when trying to use it if a call lasts too long or never returns.
>
> The fix is in a bug branch:
> https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?h=bug/923400
>
> It consists in a behavior change of SigarAccessHandler. Let me paste
> here the new Javadoc of the class:
>
> ****
> An InvocationHandler for a org.hyperic.sigar.SigarProxy.
>
> A single instance of this class will be created by the SigarAccess class.
>
> This class holds a shared Sigar instance and serializes calls. If a
> thread waits more than 'sharedSigarLockMaxWait' seconds, it will be
> given a new Sigar instance, which will be destroyed at the end of the call.
>
> Every 5 minutes, a background task checks that 'sigarInstancesThreshold'
> has not been exceeded. It it has, a warning message will be logged,
> optionally with a thread dump.
> This class is configurable with System properties:
> * sharedSigarLockMaxWait: maximum time a thread will wait for the shared
> Sigar lock acquistion; defaults to 5
> * sigarInstancesThreshold: threshold of currently living Sigar instances
> at which the background task will print warning messages; defaults to 50
> * threadDumpOnSigarInstancesThreshold: if set to true (case
> insensitive), the background task will also log a thread dump when
> sigarInstancesThreshold is met
> ****
>
> This change will not prevent problems like the one Elias reported (a
> call to #getMountedFileSystemUsage never returning because of a bad FS
> mount). But it will put the agent in some sort of degraded mode where
> other calls to Sigar will succeed and warnings will be logged. It should
> even be possible to fire an alert on this log event if the agent is
> inventoried.
>
> What's your opinion?
>
> Thanks and regards,
> Thomas
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/rhq-devel



More information about the rhq-devel mailing list