Opened 12 years ago

Last modified 7 years ago

#575 closed defect (Fixed)

cpuworker races to close logs

Reported by: arma Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.2.0.9-alpha
Severity: Keywords:
Cc: arma, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

moria1 running 0.2.0.14-alpha when I ^c'ed and let it close after 30 seconds, it
ended with a seg fault.

#0 logv (severity=6, domain=32768, funcname=0x4ae3cf "cpuworker_main",

format=0x4adeb0 "CPU worker exiting because Tor process closed connection (either rotated keys or died).", ap=0x41000d70) at log.c:246

246 if (severity > lf->min_loglevel severity < lf->max_loglevel) {
(gdb) print lf
$1 = (logfile_t *) 0x20
(gdb) where
#0 logv (severity=6, domain=32768, funcname=0x4ae3cf "cpuworker_main",

format=0x4adeb0 "CPU worker exiting because Tor process closed connection (either rotated keys or died).", ap=0x41000d70) at log.c:246

#1 0x000000000048473f in _log_fn (severity=6294272, domain=0, fn=0x600b00 "",

format=0x2b809b5f73fd "Z^Ã\213W\020H\211ø\205Òu\006óÃfff\220H\213\177\bL\213\030Aÿãff\220ff\220\203ç\002u#d\213\024%¨") at log.c:304

#2 0x0000000000438207 in cpuworker_main (data=<value optimized out>)

at cpuworker.c:258

#3 0x000000000048a395 in tor_pthread_helper_fn (_data=0x24a9150)

at compat.c:1367

#4 0x00002b809b30ef1a in start_thread () from /lib/libpthread.so.0
#5 0x00002b809b5eb6c2 in clone () from /lib/libc.so.6
#6 0x0000000000000000 in ?? ()

Is it racing with the main thread to print its log entry while closing the log?

[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (3)

comment:1 Changed 12 years ago by nickm

See comments in log.c, and see also bug 222.

I've wrapped all the log stuff in a mutex to keep this from happening again. Initial testing on
linux and osx shows no significant performance hit; it looks like locking stuff is fast.

(fixed in r13019)

comment:2 Changed 12 years ago by nickm

flyspray2trac: bug closed.

comment:3 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.