#502: cw_mutex_trylock has sometimes problems locking the channel (Fixed)

Aug 10 2009 * 20:39
Reported by: Release: 1.2
Priority: Major Milestone: 2.0
Component: core Assigned to: mjagdis

After hours of debugging (i’m not a C coder) i found out that my devicestate-problems are mutex locking related.

The problem is that sometimes the trylock in channel_find_locked() (corelib/channel.c) is not able to lock the channel. I have absolutley no idea why.

OS is Debian Lenny (fresh install)

I replaced the trylock with lock for the moment and it works but i have no idea what this may cause (race-condition etc.)

Also setting the number of retries from 10 to 1000 fixes this issue mostly.

Regards,

Joerg

Changelog:

Modified by Jun 05 2010 * 12:34
  • Component: set to core
  • Assigned user: set to mjagdis
  • Status: changed from Open to Fixed
  • Milestone: changed from 1.2.1 to 2.0

It’s because the locking scheme and data structures inherited from * are so bad. I believe this is no longer an issue in trunk – largely because in trunk channels are ref counted objects and stored in hash tables rather than lists.