[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #1313 [Torctl]: Potential thread leak in TorCtl



#1313: Potential thread leak in TorCtl
--------------------------+-------------------------------------------------
    Reporter:  kaner      |       Owner:  mikeperry
        Type:  defect     |      Status:  closed   
    Priority:  minor      |   Milestone:           
   Component:  Torctl     |     Version:  0.2.1.24 
  Resolution:  duplicate  |    Keywords:           
      Parent:             |      Points:           
Actualpoints:             |  
--------------------------+-------------------------------------------------
Changes (by atagar):

  * status:  new => closed
  * resolution:  None => duplicate


Old description:

> TorCtl seems to leak threads, more exactly TorCtl.Connection leaks the
> _loop thread.
>
> Here is simple python code to reproduce the leak:
>
> ---
> #!/usr/bin/python
>
> import socket
> import time
> from TorCtl import TorCtl
>
> def doCheck():
>     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>     sock.connect(("localhost", 9051))
>     control = TorCtl.Connection(sock)
>     control.authenticate("")
> control.get_info(str("ns/id/6AF64BD1DF8B92D5194760C2256EBF80F70273DD"))
>     control.close()
>     del control
>     del sock
>
> def main():
>     while True:
>         doCheck()
>         time.sleep(1)
>
> if __name__ == "__main__":
>     main()
>
> ---
>
> Simply run this program and check the number of runnung threads via `ps
> -eLf`.
>
> [Automatically added by flyspray2trac: Operating System: All]

New description:

 TorCtl seems to leak threads, more exactly TorCtl.Connection leaks the
 _loop thread.

 Here is simple python code to reproduce the leak:

 ---
 #!/usr/bin/python

 import socket
 import time
 from TorCtl import TorCtl

 def doCheck():
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     sock.connect(("localhost", 9051))
     control = TorCtl.Connection(sock)
     control.authenticate("")
 control.get_info(str("ns/id/6AF64BD1DF8B92D5194760C2256EBF80F70273DD"))
     control.close()
     del control
     del sock

 def main():
     while True:
         doCheck()
         time.sleep(1)

 if __name__ == "__main__":
     main()

 ---

 Simply run this program and check the number of runnung threads via `ps
 -eLf`.

 [Automatically added by flyspray2trac: Operating System: All]

--

Comment:

 I just retested this with my branch and it seems to be working. Most
 likely this was due to an orphaned _thread so this is being fixed by:
 https://trac.torproject.org/projects/tor/ticket/2412

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/1313#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs