Opened 2 days ago

Last modified 6 hours ago

#32048 new defect

Loading a high number of Onion V3 Descriptors trough Tor Control Port lead to sustained 100% CPU

Reported by: naif Owned by:
Priority: Medium Milestone: Tor: 0.4.3.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Loading a high number of Onion V3 Descriptors trough Tor Control Port lead to sustained 100% CPU.

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

1516 debian-+ 20 0 136604 122136 8880 R 100.0 6.0 95:16.49 tor

This is a GlobaLeaks system, try.globaleaks.org that have more than 1200 evaluation whistleblowing sites.

Trying profiling with strace and ltrace gives those data, if could be interesting to diagnose what's the issue:

root@scw-nostalgic-stonebraker:/var/log# strace -f -c -p 1516
strace: Process 1516 attached
strace: [ Process PID=1516 runs in x32 mode. ]
strace: [ Process PID=1516 runs in 64 bit mode. ]
Cstrace: Process 1516 detached
% time seconds usecs/call calls errors syscall


100.00 0.008475 15 560 getpid

0.00 0.000000 0 36 read
0.00 0.000000 0 22 write
0.00 0.000000 0 1 close
0.00 0.000000 0 6 ioctl
0.00 0.000000 0 7 sendto
0.00 0.000000 0 6 getsockopt
0.00 0.000000 0 1 rename
0.00 0.000000 0 2 epoll_wait
0.00 0.000000 0 14 epoll_ctl
0.00 0.000000 0 1 openat
0.00 0.000000 0 64 getrandom


100.00 0.008475 720 total

root@scw-nostalgic-stonebraker:/var/log# ltrace -c -f -p 1516
C% time seconds usecs/call calls function


25.29 2.614242 127 20496 strlen
24.99 2.583754 126 20489 free
24.93 2.577376 125 20496 memset
24.70 2.553016 124 20485 strchr

0.02 0.002249 173 13 gettimeofday
0.02 0.001980 94 21 time
0.01 0.001290 86 15 vsnprintf_chk
0.01 0.000653 130 5 pthread_mutex_lock
0.01 0.000642 128 5 pthread_mutex_unlock
0.00 0.000494 82 6 strcasecmp
0.00 0.000494 98 5
vasprintf_chk
0.00 0.000439 87 5 pthread_getspecific
0.00 0.000423 84 5 event_active
0.00 0.000420 84 5 malloc


100.00 10.337472 82051 total

Tor version 0.3.5.8-1 is stock on Ubuntu Bionic .

Child Tickets

Change History (3)

comment:1 Changed 2 days ago by nickm

Milestone: Tor: 0.4.3.x-final

comment:2 Changed 2 days ago by nickm

Component: - Select a componentCore Tor/Tor

Do you think you could get an profile from 'perf' or 'oprofile'? The set of library functions that ltrace is reporting suggests that might not be so hard to fix, but to do so, we'll need some way to figure out what place in Tor is spending so much of its time in string processing for this case.

comment:3 Changed 6 hours ago by naif

I'm not specifically skilled in using perf or oprofile, could you tell me which specific "perf" diagnostic would it be useful for such purpose?

Or if you need us to build Tor from source code with some debug flags, just provide a guidance and we'll make the testing

Cross-ref ticket on GlobaLeaks Github https://github.com/globaleaks/GlobaLeaks/issues/2709

Note: See TracTickets for help on using tickets.