<html><head></head><body>Did you investigate all crash reports to verify that none of them were not caused by the unspecified constraints that you claim exist? Did you check what the implementations on affected macOS versions actually does apply those constraints? All that I see is that the Darwin doc contradicts your statement.<br><br><div class="gmail_quote">Le 29 octobre 2019 09:10:36 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">OK, it's an UB, but on a constrained environment, that is macOS. For now, this UB seem to have 0 impact on users. As Marvin said, we had this issue since 7 years, VLC 3.x and 2.x users don't seem to be bothered by this.<br><br>We can't abort VLC for an UB that won't have any impact.<br><br>I'm OK with this patch and with a 3.0 backport. It is was I do locally every time I develop on macOS (in fact, I just define NDEBUG for this file).<br><br>One other argument in favor: this may be only temporary since Marvin finally reported this issue to Apple.<br><br><br>On Tue, Oct 29, 2019, at 04:26, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le maanantaina 28. lokakuuta 2019, 22.35.49 EET Marvin Scholz a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">On 28 Oct 2019, at 18:46, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;">Le maanantaina 28. lokakuuta 2019, 19.24.44 EET Marvin Scholz a écrit<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">macOS pthread implementation for pthread_cond_wait is buggy, causing<br>sometimes the mutex to not be locked when running thread cancellation<br>cleanup handlers.<br>This causes random failures of vlc_mutex_unlock, as the cancellation<br>cleanup handler does not hold a lock on the mutex in rare cases.<br></blockquote>This won't work:<br><br>1) Darwin does not define unlocking a mutex by a thread that did not<br>lock it:<br>"Calling pthread_mutex_unlock with a mutex that the calling thread<br>does not<br>hold will result in undefined behavior." So you cannot simply assume<br>that it<br>will return an error and have no side effects; it probably only works<br>that way<br>on sunny day cases.<br><br>2) Even if Darwin did provide that guarantee, this would cause data<br>races if<br>the calling thread actually relied on the mutex being locked to access<br>lock-<br>protected data.<br></blockquote>Hi, thanks for the review.<br>I am aware of these issues, the intention of this is just to make debug<br>enabled<br>builds on macOS work again without randomly crashing all the time.<br></blockquote>No, you don't seem to be aware of what UB means. You cannot recover from UB. <br>Period. This is too late in code flow to put a workaround; we always put our <br>workarounds before the bug, not after it.<br><br>The only ways to handle UB is to 1) avoid getting there in the first place and <br>2) abort as simply and quickly as possible if it happens anyway. It's not even <br>about debugging, it's about security/safety.<br><br>If your argument is that the error actual happens, the correct solution is to <br>replace the assert with an abort. Otherwise you concretely might as well <br>deadlock, or fail the following lock or destroy, which are even worst than.<br><br>-- <br>レミ・デニ-クールモン<br><a href="http://www.remlab.net/">http://www.remlab.net/</a><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>