[collectd] collectd 5.10 threading

Cyril Feraudet collectd at feraudet.com
Mon Sep 17 10:18:31 CEST 2012


On 14 sept. 2012, at 21:19, Brandon Hume <hume-ml+collectd at bofh.ca> wrote:

> On 09/14/12 12:37 PM, Cyril Feraudet wrote:
>> This is mine ;-) Try the last version on my branch.
>> This plugin work fine in a large environment (5300 server and more than 19000 update by second in MySQL) but never tested on Solaris.
> 
> I think I found the issue.  If you look at:
> 
>    https://github.com/feraudet/collectd/blob/cf/perfwatcher/src/write_mysql.c#L532-576
> 
> On line 536 the mutex is unlocked.  And then, on line 576 it's unlocked again.  On a sufficiently fast/multithreaded machine another thread can grab the lock in between those two lines, and then probably get hung up on I/O talking to the mysql server right afterward.  Then the lock gets undone, and then another thread will lock it again and try to talk to Mysql on its own.
> 
> So the locks/unlocks get out of sync and there's no longer exclusive access to the database handle.
> 
> Since there's an unlock on line 572, the one on line 576 can probably be removed.


You're right this mutex is unlocked twice. It's fixed in git now.

Thanks for debugging,

Cyril


More information about the collectd mailing list