sorry if this has been answered before, but I couldn't find any information about the problem.
I'm using the following modules and versions:
threads : 1.86
threads::shared : 1.4
Thread::Queue : 2.00
I like to use a boss/worker model to process performance measurements. Thread 0 receives meas and pushes it to a Queue. Worker threads pop the incoming records from the queue parses them and stores the essential part in a file (RRD to be more concrete).
To protect each file used to store the meas (during the update) I created a Semaphore associated with the file. A global (anonymous) array stores the semaphores. Association is via common array index.
What I observe that each worker thread has an own copy of the thread objects (actually works like designed for thread module). Anyway the protection of the critical sections doesn't work. After some time there's a simultaneous access of the RRD file and the script terminates with SEGV.
Does anyone made has a workaround for this. Many thanks in advance for any hint...
Cheers
-Frank Heckes
Btw. I tried some similar mechanism creating lockfiles associated with each RRD, sysopen lock file, store filehandle in array and using flock to protect the critical section. Here each thread has an own copy of the filehandles, too and flock seems to fail, i.e. script dies again with segmentation violation after some time.