[tor-bugs] #27813 [Core Tor/Tor]: Tor 0.3.4.8 is leaking memory

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Oct 16 07:05:16 UTC 2018


#27813: Tor 0.3.4.8 is leaking memory
-------------------------------------------------+-------------------------
 Reporter:  anong                                |          Owner:  (none)
     Type:  defect                               |         Status:  new
 Priority:  Very High                            |      Milestone:  Tor:
                                                 |  0.3.5.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.4.8
 Severity:  Critical                             |     Resolution:
 Keywords:  regression? memleak oom              |  Actual Points:
  034-backport tor-relay 035-must                |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by Christian):

 Interesting. I stumbled across this report via tor-talk and appear to
 experience a similar issue. Non-exit node running on openSUSE Tumbleweed
 in VM with 1 GB RAM. Upgraded from tor-0.3.3.9 to tor-0.3.4.8 on September
 16. Ever since tor gets killed twice a day by the OOM killer:

 {{{
   OOM date
     2 2018-02
    23 2018-09
    26 2018-10
 }}}

 I can't really put more memory into the machine, so I tried to use
 [https://www.kernel.org/doc/Documentation/blockdev/zram.txt zram] and now
 [https://www.kernel.org/doc/Documentation/vm/zswap.txt zswap] to save some
 memory, but the OOM killer still thinks tor is using too much memory.
 Yesterday's OOM kill happend at 15:27 local time, so let's look at the
 memory usage around that time:

 {{{
 $ sar -f /var/log/sa/sa20181015 -s 15:25 -e 15:30 -r -S
 Linux 4.18.12-1-default (cloud)         10/15/2018      _x86_64_        (2
 CPU)

 03:25:01 PM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached
 kbcommit   %commit  kbactive   kbinact   kbdirty
 03:26:01 PM     95876     21496    797884     79.11      6604     37264
 380396     29.94     88728     87552         0
 03:27:21 PM    865980    781032     53680      5.32      3748     21556
 194388     15.30      9528     17088        36
 03:28:01 PM    529876    560976    205424     20.37      5564    207108
 333216     26.22    180396    184756     45472
 03:29:01 PM    520572    560204    206152     20.44      6936    213964
 333596     26.25    187636    187700       124
 Average:       503076    480927    315785     31.31      5713    119973
 310399     24.43    116572    119274     11408

 03:25:01 PM kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
 03:26:01 PM     23112    239028     91.18       688      0.29
 03:27:21 PM    203400     58740     22.41      1932      3.29
 03:28:01 PM    204168     57972     22.11      2048      3.53
 03:29:01 PM    205192     56948     21.72      2848      5.00
 Average:       158968    103172     39.36      1879      1.82
 }}}

 (Yes, I'm running sadc every minute now because of this)

 So, I assume `%memused` went from 79.11% to 100% in a few seconds until
 tor was killed at 15:27:19 according to syslog. Swap usage (%swpused) is
 dangerously high with 91.18% -- however, I only switched to `zswap` a few
 days ago and used `zram` earlier, where %swpused would always < 60%, maybe
 tor was trying to allocate memory so quickly that `zram` could not keep
 up.

 Are there any tweaks besides [https://www.torproject.org/docs/tor-manual-
 dev.html.en#MaxMemInQueues MaxMemInQueues] to limit Tor's memory usage?

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


More information about the tor-bugs mailing list