[pulseaudio-discuss] PulseAudio 0.9.21 deadlocking when accessed through OpenAl 1.10.622 (AlienArena)

Kelly Anderson kelly at silka.with-linux.com
Tue Jan 5 17:02:48 PST 2010


On 01/05/2010 12:38 PM, Lennart Poettering wrote:
> On Wed, 23.12.09 13:42, Kelly Anderson (kelly at silka.with-linux.com) wrote:
>
>    
>>>> Here's an strace (with prints sprinkled in the OpenAl pulse code) which
>>>> demonstrates the deadlock.  A patch to undo the commit is at the end.
>>>>          
>>> Does
>>> http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=978d33b609969c3b9bbbd759e0f11aaf856c80cf
>>>
>>> Fix the problem?
>>>
>>>        
>> volatile does not fix the problem.  It still deadlocks unless I
>> revert the original commit.
>>      
> I am quite sure that
> http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=c5fdbeab85dfe69ebaec92969ec2ce77b105f1df
> fixes the problem.
>
> Could you please verify that?
>
> Thanks,
>
> Lennart
>
>    
It does not fix the deadlock.  I still need to revert the patch that 
initiated the problem.

Here is a copy of the function in OpenAl 1.10.622 with a comment on when 
and where the deadlock occurs.

static ALCboolean pulse_open(ALCdevice *device, const ALCchar 
*device_name) //{{{
{
     pulse_data *data = ppa_xmalloc0(sizeof(pulse_data));
     pa_context_state_t state;

     AL_PRINT("pulse_open()\n");
     if(ppa_get_binary_name(data->path_name, sizeof(data->path_name)))
         data->context_name = ppa_path_get_filename(data->path_name);
     else
         data->context_name = "OpenAL Soft";

     AL_PRINT("starting pa_threaded_mainloop_new()\n");
     if(!(data->loop = ppa_threaded_mainloop_new()))
     {
         AL_PRINT("pa_threaded_mainloop_new() failed!\n");
         goto out;
     }

     AL_PRINT("starting pa_threaded_mainloop_start()\n");
     if(ppa_threaded_mainloop_start(data->loop) < 0)
     {
         AL_PRINT("pa_threaded_mainloop_start() failed\n");
         goto out;
     }

     AL_PRINT("starting pa_threaded_mainloop_lock()\n");
     ppa_threaded_mainloop_lock(data->loop);
     device->ExtraData = data;

     AL_PRINT("starting pa_context_new()\n");
     data->context = 
ppa_context_new(ppa_threaded_mainloop_get_api(data->loop), 
data->context_name);
     if(!data->context)
     {
         AL_PRINT("pa_context_new() failed: %s\n",
                  ppa_strerror(ppa_context_errno(data->context)));

         ppa_threaded_mainloop_unlock(data->loop);
         goto out;
     }

     AL_PRINT("starting pa_context_set_state_callback()\n");
     ppa_context_set_state_callback(data->context, 
context_state_callback, device);

     AL_PRINT("starting pa_context_connect()\n");
     if(ppa_context_connect(data->context, NULL, PA_CONTEXT_NOAUTOSPAWN, 
NULL) < 0)
     {
         AL_PRINT("Context did not connect: %s\n",
                  ppa_strerror(ppa_context_errno(data->context)));

         ppa_context_unref(data->context);
         data->context = NULL;

         ppa_threaded_mainloop_unlock(data->loop);
         goto out;
     }

     AL_PRINT("starting pa_context_get_state()\n");
     for (;;)
     {
         state = ppa_context_get_state(data->context);
         if(!PA_CONTEXT_IS_GOOD(state))
         {
             AL_PRINT("Context did not get ready: %s\n",
                      ppa_strerror(ppa_context_errno(data->context)));

             ppa_context_unref(data->context);
             data->context = NULL;

             ppa_threaded_mainloop_unlock(data->loop);
             goto out;
         }

         if (state == PA_CONTEXT_READY)
             break;
         AL_PRINT("starting pa_threaded_mainloop_wait(), state=%s\n"
             , getContextState(state));
         ppa_threaded_mainloop_wait(data->loop);
********->  It consistently deadlocks here the second time through the 
loop **********

         AL_PRINT("starting pa_threaded_mainloop_accept()\n");
         ppa_threaded_mainloop_accept(data->loop);
     }
     AL_PRINT("starting pa_context_set_state_callback()\n");
     ppa_context_set_state_callback(data->context, 
context_state_callback2, device);

     device->szDeviceName = strdup(device_name);

     AL_PRINT("starting pa_threaded_mainloop_unlock()\n");
     ppa_threaded_mainloop_unlock(data->loop);
     return ALC_TRUE;

out:
     if(data->loop)
     {
         ppa_threaded_mainloop_stop(data->loop);
         ppa_threaded_mainloop_free(data->loop);
     }

     device->ExtraData = NULL;
     ppa_xfree(data);
     return ALC_FALSE;
} //}}}






More information about the pulseaudio-discuss mailing list