[tor-bugs] #33006 [Core Tor/Tor]: Fix test-stem `test_take_ownership_via_controller` failure

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Jan 23 18:33:25 UTC 2020


#33006: Fix test-stem `test_take_ownership_via_controller` failure
--------------------------+------------------------------------
 Reporter:  teor          |          Owner:  teor
     Type:  defect        |         Status:  reopened
 Priority:  Medium        |      Milestone:  Tor: 0.4.3.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:  043-should    |  Actual Points:
Parent ID:  #33039        |         Points:  1
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by nickm):

 Taylor and I have been investigating this and here is what we found:

 The integ/process.py code is doing this test to see whether Tor is
 running:
 {{{
         if tor_process.poll() == 0:
            return  # tor exited
 }}}

 This is calling the `poll` method of a subprocess.Popen() object, which
 only returns 0 when the process exits with an exitcode of 0.  If Tor exits
 with any other exit code, it will return something else.

 In this case, I found that Tor was actually exiting with a SIGPIPE,
 because of this chain of events:
    * stderr had been closed by stem.
    * There was a memory leak (#33039), and so LeakSanitizer was trying to
 write to stderr.
    * LeakSanitizer couldn't write to stderr (because it was closed), and
 so it got a SIGPIPE.

 We didn't notice this at the time because there was nothing to tell us
 that the bug had actually occurred.

 I think we have a few things to work on here.
   * I've opened #33039 for the leak.  We should fix that in 0.4.3.
   * I've opened a pull request against stem so that it gives a more
 accurate message if Tor fails during theses tests:
 https://github.com/torproject/stem/pull/54 .  I hope it's in the right
 place.  (I did not find any other cases where stem was using the
 `poll()==0` pattern.)
   * We should find some way to make it so that when stem is running its
 tests, it does not close Tor's stderr, but rather reports stderr output as
 a test failure.  This will make it likelier that we will notice
 LeakSanitizer failures in the future.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33006#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list