Opened 2 years ago

Last modified 19 months ago

#24308 new defect

MaxMemInCellQueues minimum of 256MB is still too large for low-RAM relays (LEDE and OpenWRT routers)

Reported by: pmetras Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version: Tor: 0.2.9.12
Severity: Normal Keywords: tor-relay, lowmem, openwrt, lede, router, 033-triage-20180320, 033-removed-20180320
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

The minimum value for torrc configuration MaxMemInCellQueues of 256MB is still too large for memory constrained relays. I've been running a tor relay on my OpenWRT router for a few years reliably. I recently upgraded the router to use tor 0.2.9.12 where MaxMemInCellQueues is minimally defaulted to 256MB, even if the router only has 128 MB. Naturally, Linux oom-killer kills it after a few hours. I have a lot of bandwidth but I can't share it now...

This is related to ticket #9686

Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.070987] Mem-Info:
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.073403] active_anon:18341 inactive_anon:51 isolated_anon:0
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.073403]  active_file:35 inactive_file:73 isolated_file:0
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.073403]  unevictable:0 dirty:0 writeback:0 unstable:0
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.073403]  slab_reclaimable:728 slab_unreclaimable:2804
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.073403]  mapped:41 shmem:1120 pagetables:102 bounce:0
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.073403]  free:4723 free_pcp:40 free_cma:0
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.106437] Normal free:18892kB min:16384kB low:20480kB high:24576kB active_anon:73364kB inactive_anon:204kB active_file:
140kB inactive_file:292kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:131072kB managed:125640kB mlocked:0kB dirty:0kB writeback:0kB mapped:164kB shmem
:4480kB slab_reclaimable:2912kB slab_unreclaimable:11216kB kernel_stack:544kB pagetables:408kB unstable:0kB bounce:0kB free_pcp:160kB local_pcp:160kB free_cma:0kB write
back_tmWed Nov 15 11:24:32 2017 kern.warn kernel: [221491.151989] lowmem_reserve[]: 0 0
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.155468] Normal: 763*4kB (UMEH) 446*8kB (UMEH) 255*16kB (UMEH) 44*32kB (UME) 20*64kB (UMEH) 3*128kB (UME) 2*256kB (UH)
 1*512kB (U) 4*1024kB (UMH) 0*2048kB 0*4096kB = 18892kB
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.171705] 1228 total pagecache pages
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.175610] 0 pages in swap cache
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.179077] Swap cache stats: add 0, delete 0, find 0/0
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.184476] Free swap  = 0kB
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.187482] Total swap = 0kB
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.190505] 32768 pages RAM
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.193422] 0 pages HighMem/MovableOnly
Wed Nov 15 11:24:32 2017 kern.warn kernel: [221491.197412] 1358 pages reserved
Wed Nov 15 11:24:32 2017 kern.info kernel: [221491.200683] [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds swapents oom_score_adj name
...
Wed Nov 15 11:24:32 2017 kern.info kernel: [221491.370877] [28850]    52 28850    21220    15276      25       0        0             0 tor
Wed Nov 15 11:24:32 2017 kern.info kernel: [221491.379539] [ 9935]     0  9935      296        9       3       0        0             0 sleep
Wed Nov 15 11:24:32 2017 kern.err kernel: [221491.388387] Out of memory: Kill process 28850 (tor) score 487 or sacrifice child
Wed Nov 15 11:24:32 2017 kern.err kernel: [221491.396016] Killed process 28850 (tor) total-vm:84880kB, anon-rss:61096kB, file-rss:8kB

Child Tickets

Change History (6)

comment:1 Changed 2 years ago by asn

Milestone: Tor: 0.2.9.x-finalTor: 0.3.3.x-final

Hmm, seems like the minimum has been 256MB since like 0.2.5 (commit 17ecd04fde2f). Isn't that true? Which version were you running before 0.2.9, and did it actually allow you to specify a smaller value?

I'm not sure why the minimum is 256MB, it seems to be from #11396.

Triaging this into 0.3.3. This is not a security issue so it doesn't warrant a backport as far back as 0.2.9.

Thanks for running a relay and sorry for making it hard for you! :)

Last edited 2 years ago by asn (previous) (diff)

comment:2 Changed 23 months ago by pmetras

For your information, the previous version of Tor on OpenWRT Chaos Calmer was TorVersion Tor 0.2.5.12 indeed, now declared insecure.

I didn't had to specify a MaxMemInCellQueues value with that version. The warning "Using 256MB..." and the crashes appeared in the log with 0.2.9

May I suggest that using a negative number like MaxMemInCellQueues -128Mb will enforce the given value, bypassing the default? I understand that low-RAM hardware has to be tuned by owners and won't/should'n support automatic defaults blindly. So if the admin decides to overwrite the software defaults, that's his own responsibility and it should not happen by mistake.

If I know the syntax you'll be using, I can backport the code in my version and my relay will be up again. Thanks.

comment:3 Changed 23 months ago by pmetras

Reading from the documentation that the torrc options can also be given at the command line, -128MB is not a good choice. Perhaps adding a "+" like +128MB to enforce the specified parameters is probably better.

comment:4 Changed 19 months ago by nickm

Keywords: 033-triage-20180320 added

Marking all tickets reached by current round of 033 triage.

comment:5 Changed 19 months ago by nickm

Keywords: 033-removed-20180320 added

Mark all not-already-included tickets as pending review for removal from 0.3.3 milestone.

comment:6 Changed 19 months ago by nickm

Milestone: Tor: 0.3.3.x-finalTor: unspecified

These tickets were marked as removed, and nobody has said that they can fix them. Let's remember to look at 033-removed-20180320 as we re-evaluate our triage process, to see whether we're triaging out unnecessarily, and to evaluate whether we're deferring anything unnecessarily. But for now, we can't do these: we need to fix the 033-must stuff now.

Note: See TracTickets for help on using tickets.