{"id":436,"date":"2015-04-27T11:41:35","date_gmt":"2015-04-27T15:41:35","guid":{"rendered":"http:\/\/blog.mozilla.org\/nfroyd\/?p=436"},"modified":"2015-04-27T11:41:35","modified_gmt":"2015-04-27T15:41:35","slug":"recent-tsan-improvements-for-firefox","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nfroyd\/2015\/04\/27\/recent-tsan-improvements-for-firefox\/","title":{"rendered":"recent tsan improvements for firefox"},"content":{"rendered":"<p>One of my goals for Q2 was to make Firefox usable with &#8220;modern&#8221; (version 3.6+) clang. For reasons previously unknown, Firefox would only work with relatively old clang (version ~3.3); indeed, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Thread_Sanitizer\">our wiki page for TSan<\/a> recommends checking out specific SVN versions!<\/p>\n<p>I&#8217;m happy to say that goal has been met.\u00a0 If you like, you can read (some of) the gory details in <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1153244\">bug 1153244<\/a>.\u00a0 Checking out a development version of Clang and building that should enable you to test Firefox (from <a href=\"https:\/\/hg.mozilla.org\/mozilla-central\/\">mozilla-central<\/a>, since that&#8217;s where the aforementioned bug has landed thus far) with TSan.\u00a0 Upgrading through several major releases has its benefits: TSan appears to be somewhat more stable&#8212;tests that would previously timeout reliably now run without complaint.\u00a0 I&#8217;m not sure that it&#8217;s quite reliable enough to run in automation yet, but running TSan tests in automation is definitely more feasible than it was last quarter.<\/p>\n<p>With an eye towards doing that, and also with an eye towards improving individual developer experience, I&#8217;ve recently landed several patches that teach our test harnesses about TSan-specific things.\u00a0 For instance, when we&#8217;re running <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Mochitest\">mochitests<\/a>, we only care about races in the browser itself; we don&#8217;t care about races while running any of the supporting tools (particularly <code>xpcshell,<\/code> which shares a lot of code with the browser through libxul).\u00a0 So TSan should only be enabled for the actual browser executable.\u00a0 We already do similar things for our ASan builds.<\/p>\n<p>I also discovered that my local builds weren&#8217;t using the <a href=\"http:\/\/llvm.org\/docs\/CommandGuide\/llvm-symbolizer.html\"><code>llvm-symbolizer<\/code> tool<\/a> to produce backtraces in TSan&#8217;s reports, but instead defaulting to using <code>addr2line<\/code>.\u00a0 <code>addr2line<\/code> is a fine tool, but <code>llvm-symbolizer<\/code> understands debug information better (for instance, it shows you synthesized frames for inlined functions, which is a huge win) and <code>llvm-symbolizer<\/code> is somewhat faster than <code>addr2line<\/code>. In my case, it was a combination of <code>llvm-symbolizer<\/code> not being in my <code>PATH<\/code>, and not informing TSan about the location of <code>llvm-symbolizer<\/code> (<code>$OBJDIR\/dist\/bin\/<\/code>, usually). The former was addressed by setting <code>LLVM_SYMBOLIZER<\/code> in my mozconfig (not necessary if <code>llvm-symbolizer<\/code> is on your <code>PATH<\/code>), and the latter was addressed by adding a bit of code to our test scripts.<\/p>\n<p>Now, to update the wiki with better instructions!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of my goals for Q2 was to make Firefox usable with &#8220;modern&#8221; (version 3.6+) clang. For reasons previously unknown, Firefox would only work with relatively old clang (version ~3.3); indeed, our wiki page for TSan recommends checking out specific SVN versions! I&#8217;m happy to say that goal has been met.\u00a0 If you like, you [&hellip;]<\/p>\n","protected":false},"author":320,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,72430],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/posts\/436"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/users\/320"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/comments?post=436"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/posts\/436\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/media?parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/categories?post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nfroyd\/wp-json\/wp\/v2\/tags?post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}