Using Address Sanitizer with TrafficServer
Verifying Traffic Server with
AddressSanitizer is fairly
straight-forward. On Linux, you need recent gcc
or clang
and the
libasan
library. On OS X, libasan
wasn’t present, so I just switched
to Linux ;)
You should give --enable-asan
to configure
when you build. The build
system will enable ASAN on all the parts that should have it. Then,
whenever you run you will get ASAN checking memory state.
LeakSanitizer
reports leaks from an
atexit(3)
handler, so you need to ensure that the program exits rather than
calls _exit(2) or
dumps core. If you are using traffic_manager
, then you can set the
PROXY_AUTO_EXIT
variable to have traffic_server
voluntarily exit
after the specified number of seconds. LeakSanitizer will kindly print
a leak report each time it exits, and traffic_manager
will start it
up for you to test again.