OSSP CVS Repository |
![]() |
|
Calls to mm_core_lock from mm_alloc.c with mode=MM_LOCK_RD cause deadlock sometimes (MM_SEMT_IPCSEM is defined in config.h).
To reproduce the problem I have one daemon process that created shared MM region and went to sleep (waiting for a messages) and a number of other processes which are being started repeatedly in endless script while doing the following:
- attaching to this MM region
- allocating a chunk of memory
- calling mm_display_info
- deallocating the memory, just allocated
- calling mm_display_info
- exiting
After a short while the deadlock occurs and I see that processes are waiting forever in "while" loops in mm_core_lock.
To workaround the problem I always use only mode MM_LOCK_RW while calling mm_core_lock from mm_alloc.c - this works just fine.
|
MM package was used in a multiprocess environment where communicating processes (using the same shared memory region) are NOT related, therefore in a multireader scenario we easily can get into situation when a process will try to unlock a semaphore (when number of readers goes to 0) which was locked by some other process (the first reader). Of course, it won't work. I was able to prove (with some debug printouts added) that it's exactly what happens.
In MM description one can read: "..usage of shared memory between forked (and this way strongly related) processes..." and this requirement was obviously violated. I believe that the only reasonable workaround for our environment is the one I already have - not to use MM_LOCK_RD locking mode but only MM_LOCK_RW.
|
Type: code Version: 1.4.0 Status: closed Created: 2005-Sep-29 23:54 Severity: 2 Last Change: 2005-Dec-14 19:32 Priority: 4 Subsystem: mm Assigned To: rse Derived From: Creator: anonymous