Re: [Jack-Devel] Lock recursion in Trylock()

PrevNext  Index
DateMon, 10 Dec 2012 16:28:52 +0100
From Stéphane Letz <[hidden] at grame dot fr>
To"MONTANARO Luciano (MM)" <[hidden] at magnetimarelli dot com>
Cc"[hidden] at lists dot jackaudio dot org" <[hidden] at lists dot jackaudio dot org>
In-Reply-ToMONTANARO Luciano (MM) [Jack-Devel] Lock recursion in Trylock()
Right: messages removed, commited on my local branch, will push soon.

Stéphane 

Le 10 déc. 2012 à 14:46, MONTANARO Luciano (MM) a écrit :

> Hi all,
> This is the first time I am writing to the list. I am not sure this is the right place to send patches, just let me know if you prefer the use of a different channel.
> I am using jack in an embedded linux project, and I have had to analyze a crash dump from a (heavily threaded) client application, which failed on the
> Jack_error line in JackPosixMutex.cpp: Trylock().
> 
> The cause of this is that jack_error() will call JackMessageBuffer::AddMessage() which will call Trylock(), which, if the lock is held, will call jack_error(), and the wole sequence will repeat until the stack is exhausted.
> 
> Below is a patch that simply disables the jack_error call for this case. Is it actually an error to call Trylock() from a different thread? This seems more like a copy-paste remnant from the Lock() function. The jack_error() calls in Lock() and Unlock() are probably not a problem, though they make me a bit uncomfortable as well.
> 
> I hope this helps,
> Cheers,
> Luciano
> 
> --- a/posix/JackPosixMutex.cpp
> +++ b/posix/JackPosixMutex.cpp
> @@ -69,7 +69,10 @@ namespace Jack
>                 return false;
>             }
>         } else {
> +           /* Calling jack_error here will recursively call Trylock() if
> +            * multithreaded debugging is active.  Don't do that.
>             jack_error("JackBasePosixMutex::Trylock mutex already locked by thread = %d", current_thread);
> +            */
>             return false;
>         }
>     }
> 
> 
> 
> 
> 
> --
> Luciano Montanaro
> EntryNAV - Audio Software Integrator
> Magneti Marelli Electronic Systems
> Viale Carlo Emanuele II 150, Venaria Reale (To)
> Tel. (+39) 011 6879765
> 
> 
> 
> 
> Confidential Notice: This message - including its attachments - may contain proprietary, confidential and/or legally protected information and is intended solely for the use of the designated addressee(s) above. If you are not the intended recipient be aware that any downloading, copying, disclosure, distribution or use of the contents of the above information is strictly prohibited.
> If you have received this communication by mistake, please forward the message back to the sender at the email address above, delete the message from all mailboxes and any other electronic storage medium and destroy all copies.
> Disclaimer Notice: Internet communications cannot be guaranteed to be safe or error-free. Therefore we do not assure that this message is complete or accurate and we do not accept liability for any errors or omissions in the contents of this message.
> 
> Jack-Devel mailing list
> [hidden]
> http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
PrevNext  Index

1355153342.27132_0.ltw:2, <217A76A8-2294-4DFD-9A51-C5728EDC9936 at grame dot fr>