title: Ruby/Watir - segfault on browser.close
body: <p>My PC has been randomly locking up lately, and while debugging I found an issue with my Ruby/Watir project. Each time the browser.close function is called, the following occurs in dmesg (slightly different each time):</p>
  
  <p><code>[12614.684243] Chrome_~dThread[29941]: segfault at 0 ip 00007f17889b3992 sp 00007f1786aa0b00 error 6 in libxul.so[7f1787b6a000+519c000]</code></p>
  
  <p>I'm not sure if this is causing my PC to lock up, however it still needs resolving. I've done some searching but I can't find anyone else with this issue. The issue also appears if I <code>ctrl + c</code> the script.</p>
  
  <p>Error 6 is: <code>The cause was a user-mode write resulting in no page being found.</code>, which makes sense if I've closed the browser.</p>
  
  <p>I've read the answer on <a href="https://stackoverflow.com/questions/2549214/interpreting-segfault-messages">this page</a>, but as libxul.so is a library it didn't help much (although offered me a better understanding of debugging segfaults!).</p>
  
  <p>For those looking due to the linux/segfault tag rather than ruby/watir, browser.close is a builtin function in the Watir package.</p>
  
  <p>Edit:</p>
  
  <ul>
  <li>Although it says 'Chrome', the issue actually comes from FireFox</li>
  <li>I don't get the issue in any other browser</li>
  <li>libxul.so is found in <code>/usr/lib/firefox/</code></li>
  </ul>