<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2022:06:22</title>
        <description></description>
        <link>https://baszerr.eu/</link>
        <lastBuildDate>Sat, 18 Apr 2026 12:59:30 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://baszerr.eu/</link>
        </image>
        <item>
            <title>2022-06-22_-_logate_v1.1.1_is_out</title>
            <link>https://baszerr.eu/doku.php?id=blog:2022:06:22:2022-06-22_-_logate_v1.1.1_is_out</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;logate_v111_is_out&quot;&gt;2022-06-22 - LogATE v1.1.1 is out&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2022%3A06%3A22%3A2022-06-22_-_logate_v1.1.1_is_out&amp;amp;media=blog:2022:06:22:logate.png&quot; class=&quot;media&quot; title=&quot;blog:2022:06:22:logate.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=400&amp;amp;tok=3f0a95&amp;amp;media=blog:2022:06:22:logate.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;LogATE&amp;#039;s filter tree view&quot; alt=&quot;LogATE&amp;#039;s filter tree view&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
i&amp;#039;m pleased to announce that &lt;a href=&quot;https://baszerr.eu/lib/exe/fetch.php?tok=94258c&amp;amp;media=https%3A%2F%2Fgithub.com%2Fel-bart%2FLogATE%2Ftree%2Fv1.1.1&quot; class=&quot;media mediafile mf_1&quot; title=&quot;https://github.com/el-bart/LogATE/tree/v1.1.1&quot;&gt;LogATE v1.1.1&lt;/a&gt; is out! :) LogATE is a text-UI based tool, for analizing structured logs (in JSON format).
&lt;/p&gt;

&lt;p&gt;
the key change, compared to last release is addition of JSON arrays support. while it sounds trivial, this was a big change, as it allowed for addition of wildcard statements, so that one search path may now interact with multiple elements in the array. this allows for robust filters, checking if given element exists in an array, what fields are there, etc…
&lt;/p&gt;

&lt;p&gt;
enjoy using! :)
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 22 Jun 2022 21:41:43 +0000</pubDate>
        </item>
        <item>
            <title>2022-06-22_-_tsan_bug</title>
            <link>https://baszerr.eu/doku.php?id=blog:2022:06:22:2022-06-22_-_tsan_bug</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;tsan_bug&quot;&gt;2022-06-22 - TSAN bug&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
while preparing &lt;a href=&quot;https://baszerr.eu/doku.php?id=blog:2022:06:22:2022-06-22_-_logate_v1.1.1_is_out&quot; class=&quot;wikilink1&quot; title=&quot;blog:2022:06:22:2022-06-22_-_logate_v1.1.1_is_out&quot; data-wiki-id=&quot;blog:2022:06:22:2022-06-22_-_logate_v1.1.1_is_out&quot;&gt;release of latest LogATE&lt;/a&gt; version, i stumbled upon a bug in thread sanitizer. consider the following piece of code:
&lt;/p&gt;
&lt;pre class=&quot;code cpp&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#include &amp;lt;thread&amp;gt;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#include &amp;lt;mutex&amp;gt;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#include &amp;lt;condition_variable&amp;gt;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; main&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;auto&lt;/span&gt; ready &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;mutex&lt;/span&gt; m&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;condition_variable&lt;/span&gt; cv&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;thread&lt;/span&gt; th&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// thread 1&lt;/span&gt;
    std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;unique_lock&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt;std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;mutex&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt; lock&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#if 0&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// OK!&lt;/span&gt;
    cv.&lt;span class=&quot;me1&quot;&gt;wait&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; lock, &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; ready&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#if 0&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// ERROR!&lt;/span&gt;
    cv.&lt;span class=&quot;me1&quot;&gt;wait_until&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; lock, std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;chrono&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;steady_clock&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;chrono&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;minutes&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;, &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; ready&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#if 1&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// ERROR!&lt;/span&gt;
    cv.&lt;span class=&quot;me1&quot;&gt;wait_for&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; lock, std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;chrono&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;minutes&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;, &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; ready&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#endif&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// thread 2&lt;/span&gt;
    std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;this_thread&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;sleep_for&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;chrono&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;seconds&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// we should be wait()ing here&lt;/span&gt;
    std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;lock_guard&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt;std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;mutex&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt; lock&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;m&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    ready &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    cv.&lt;span class=&quot;me1&quot;&gt;notify_one&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  th.&lt;span class=&quot;me1&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
after compiling it with:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;g++ -fsanitize=thread  -g3 -Wall -std=c++17 test.cpp -lpthread&lt;/pre&gt;

&lt;p&gt;
we can see a very colorful output, indicating double-locking and race condition!
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=blog%3A2022%3A06%3A22%3A2022-06-22_-_tsan_bug&amp;amp;media=blog:2022:06:22:tsan_report.png&quot; class=&quot;media&quot; title=&quot;blog:2022:06:22:tsan_report.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=900&amp;amp;tok=39c4c5&amp;amp;media=blog:2022:06:22:tsan_report.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;TSAN&amp;#039;s report with warnings&quot; alt=&quot;TSAN&amp;#039;s report with warnings&quot; width=&quot;900&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
the same issue is reported with both &lt;code&gt;gcc&lt;/code&gt; and &lt;code&gt;clang&lt;/code&gt;. so the problem is in the code, right? well… no. the clue that the problem is elsewhere is when you change which version of &lt;code&gt;wait()&lt;/code&gt; is selected: regular one works fine, while time-constrained versions (i.e. deadline and timeout) report issues as below. changing C++ library does not change the output, but changing a compiler version does help.
&lt;/p&gt;

&lt;p&gt;
here are the bugs i found already reported for this:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://baszerr.eu/lib/exe/fetch.php?tok=eea492&amp;amp;media=https%3A%2F%2Fgcc.gnu.org%2Fbugzilla%2Fshow_bug.cgi&quot; class=&quot;media mediafile mf_cgi&quot; title=&quot;https://gcc.gnu.org/bugzilla/show_bug.cgi&quot;&gt;gcc bug report&lt;/a&gt;&lt;sup&gt;&lt;a href=&quot;#fn__1&quot; id=&quot;fnt__1&quot; class=&quot;fn_top&quot;&gt;1)&lt;/a&gt;&lt;/sup&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://baszerr.eu/lib/exe/fetch.php?tok=c6c344&amp;amp;media=https%3A%2F%2Fgithub.com%2Fgoogle%2Fsanitizers%2Fissues%2F1259&quot; class=&quot;media mediafile mf_com_google_sanitizers_issues_1259&quot; title=&quot;https://github.com/google/sanitizers/issues/1259&quot;&gt;clang bug report&lt;/a&gt;&lt;sup&gt;&lt;a href=&quot;#fn__2&quot; id=&quot;fnt__2&quot; class=&quot;fn_top&quot;&gt;2)&lt;/a&gt;&lt;/sup&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
i&amp;#039;ve spent quite a bit of time today, trying to narrow down the issue and making it small and reproducible issue. then it turned out it&amp;#039;s a know problem. life… ;)
&lt;/p&gt;

&lt;p&gt;
the problem has been observed on UTs. even though here it was false-positive, running automated tests with sanitizers is a really great thing to do. if you still do not do it – i strongly encourage you to start doing so! :)
&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;footnotes&quot;&gt;
&lt;div class=&quot;fn&quot;&gt;&lt;sup&gt;&lt;a href=&quot;#fnt__1&quot; id=&quot;fn__1&quot; class=&quot;fn_bot&quot;&gt;1)&lt;/a&gt;&lt;/sup&gt; 
&lt;div class=&quot;content&quot;&gt;&lt;code&gt;&lt;a href=&quot;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101978&quot; class=&quot;urlextern&quot; title=&quot;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101978&quot; rel=&quot;ugc nofollow&quot;&gt;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101978&lt;/a&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;fn&quot;&gt;&lt;sup&gt;&lt;a href=&quot;#fnt__2&quot; id=&quot;fn__2&quot; class=&quot;fn_bot&quot;&gt;2)&lt;/a&gt;&lt;/sup&gt; 
&lt;div class=&quot;content&quot;&gt;&lt;code&gt;&lt;a href=&quot;https://github.com/google/sanitizers/issues/1259&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/google/sanitizers/issues/1259&quot; rel=&quot;ugc nofollow&quot;&gt;https://github.com/google/sanitizers/issues/1259&lt;/a&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 22 Jun 2022 21:56:06 +0000</pubDate>
        </item>
    </channel>
</rss>
