On 11 Jun 2013, at 23:06, Sorin Manolache wrote:

> I'm sorry, I ran out of ideas. I suppose that the operations of the two 
> threads on the bucket brigade are protected by mutexes...

Yep. I create my own output bucket brigade too. I *presume* this uses the 
allocator mutex to manipulate the bucket brigade (or that it contains its own 
mutex) protecting its link->next pointers.

    /* We cannot use the same bucket allocator for the ouput bucket brigade
     * obb as the one associated with the connection 
(r->connection->bucket_alloc)
     * because the same bucket allocator cannot be used in two different
     * threads, and we use the connection bucket allocator in this
     * thread - see docs on apr_bucket_alloc_create(). This results in
     * occasional core dumps. So create our own bucket allocator and pool
     * for output thread bucket brigade.
     */

...

    if (
        ( apr_thread_mutex_create(&oallocatormutex, APR_THREAD_MUTEX_UNNESTED, 
r->pool) == APR_SUCCESS) &&
        ( apr_allocator_create(&oallocator) == APR_SUCCESS) &&
        ( apr_allocator_mutex_set(oallocator, oallocatormutex), 1 ) &&
        ( apr_pool_create_ex(&opool, NULL, NULL, oallocator) == APR_SUCCESS) && 
/* WARNING: pool has no parent */
        ( NULL != (obucketallocator = apr_bucket_alloc_create(opool))) &&
        ( NULL != (obb = apr_brigade_create(opool, obucketallocator)))
        ) {

-- 
Alex Bligh




Reply via email to