apache / trafficserver

Apache Traffic Serverâ„¢ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
https://trafficserver.apache.org/
Apache License 2.0
1.82k stars 804 forks source link

LSan: memory leak of pcre_jit_stack_alloc #10295

Open masaori335 opened 1 year ago

masaori335 commented 1 year ago

Testing ASan build on the ci.trafficserver.apache.org/ats/ubuntu:23.04 image, test_RWW reports below leak.

=================================================================
==31887==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x55cca653bbfe in malloc (/workspace/out_of_source_build_dir/iocore/cache/.libs/test_RWW+0x45cbfe) (BuildId: 78fb701a110a2c71fd066dfb94387949b713d8bd)
    #1 0x7fd33e366153 in pcre_jit_stack_alloc (/lib/x86_64-linux-gnu/libpcre.so.3+0x50153) (BuildId: a31cb6cce2188b34a701572e61929507b90b1926)
masaori335 commented 1 year ago

test_jsonrpcserver has the same report. The pcre version in the image has an issue?

=================================================================
==5758==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x559182a2781e in malloc (/workspace/out_of_source_build_dir/mgmt/rpc/.libs/test_jsonrpcserver+0x17281e) (BuildId: 6f8c68304776df3d8c16832e8abf348b7d545b5a)
    #1 0x7f6b6cd48153 in pcre_jit_stack_alloc (/lib/x86_64-linux-gnu/libpcre.so.3+0x50153) (BuildId: a31cb6cce2188b34a701572e61929507b90b1926)

SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).
ywkaras commented 1 year ago

I'm not able to reproduce this problem, test_RWW and test_jsonrpcserver run with no leaks. I am testing on master, commit 55f6901951c9267aab2029ac8e2422e895e8dbb0. Here is my config.nice:

#! /bin/sh
#
# Created by configure

CC="/usr/bin/gcc"; export CC
NM=""; export NM
CFLAGS=" "; export CFLAGS
CXXFLAGS="-I/opt/edge/imagemagick/7.1/include/ImageMagick-7"; export CXXFLAGS
LDFLAGS="-L/opt/edge/libssh2/1.9/lib -L/opt/edge/nghttp2/1.43/lib -L/opt/edge/imagemagick/7.1/lib -L/opt/edge/libunwind/1.5/lib"; export LDFLAGS
"./configure" \
"--with-openssl=/opt/edge/openssl/1.1.1" \
"--enable-experimental-plugins" \
"--enable-example-plugins" \
"--enable-expensive-tests" \
"--with-brotli=/opt/edge/brotli/1.0/include:/opt/edge/brotli/1.0/lib" \
"--with-pcre=/opt/edge/pcre/8.45" \
"--with-cjose=/home/wkaras/REPOS/CJOSE" \
"--enable-debug" \
"--enable-lsan" \
"--enable-ccache" \
"--enable-werror" \
"--enable-yaml-headers" \
"--prefix=/home/wkaras/TSX/TS" \
"--exec-prefix=/home/wkaras/TSX/TS" \
"PKG_CONFIG_PATH=/opt/edge/openssl/1.1.1/lib/pkgconfig:/opt/edge/libidn/1.38/lib/pkgconfig:/opt/edge/libevent/2.1/lib/pkgconfig:/opt/edge/protobuf/3.17/lib/pkgconfig:/opt/edge/protobuf-c/1.4/lib/pkgconfig:/opt/edge/pcre/8.45/lib/pkgconfig:/opt/edge/json-c/0.15/lib/pkgconfig:/opt/edge/libc-ares/1.18/lib/pkgconfig:/opt/edge/jansson/2.14/lib/pkgconfig:/opt/edge/jemalloc/5.3/lib/pkgconfig:/opt/edge/brotli/1.0/lib/pkgconfig:/opt/edge/nghttp2/1.43/lib/pkgconfig:/opt/edge/libssh2/1.10/lib/pkgconfig:/opt/edge/libcurl/7.88/lib/pkgconfig:/opt/edge/libcurl/8.0/lib/pkgconfig:/opt/edge/libjpeg-turbo/2.1/lib/pkgconfig:/opt/edge/libpng/1.6/lib/pkgconfig:/opt/edge/libwebp/1.2/lib/pkgconfig:/opt/edge/expat/2.4/lib/pkgconfig:/opt/edge/jose/11.0/lib/pkgconfig:/opt/edge/libicu/65.1/lib/pkgconfig:/opt/edge/libxml2/2.10/lib/pkgconfig:/opt/edge/libzip/1.9/lib/pkgconfig:/opt/edge/imagemagick/7.1/lib/pkgconfig:/opt/edge/libunwind/1.5/lib/pkgconfig:/opt/edge/libyaml-cpp/0.7/share/pkgconfig:/opt/edge/libyaml-cpp/0.7/lib/pkgconfig:/opt/edge/numactl/2.0/lib/pkgconfig:/opt/edge/hwloc/2.6/lib/pkgconfig:/opt/edge/libswoc/1.4.2/lib/pkgconfig:/opt/edge/libswoc/1.4.8/lib/pkgconfig:/opt/edge/trafficserver/9.1/lib/pkgconfig" \
"CC=/usr/bin/gcc" \
"CFLAGS=" \
"LDFLAGS=-L/opt/edge/libssh2/1.9/lib -L/opt/edge/nghttp2/1.43/lib -L/opt/edge/imagemagick/7.1/lib -L/opt/edge/libunwind/1.5/lib" \
"CXXFLAGS=-I/opt/edge/imagemagick/7.1/include/ImageMagick-7" \
"$@"
masaori335 commented 1 year ago

I checked with the commit, still facing the leak.

Are you running on the ci.trafficserver.apache.org/ats/ubuntu:23.04? Is this ubuntu image specific issue?

REPOSITORY                                                   TAG                        IMAGE ID       CREATED         SIZE
ci.trafficserver.apache.org/ats/ubuntu                       23.04                      8caeb2e6207d   3 months ago    2.16GB
ywkaras commented 1 year ago

Are you able to provide the config.nice for the build? Or, is it a cmake build?

masaori335 commented 1 year ago
root@a365165da8f7:/workspace/out_of_source_build_dir# cat config.nice
#! /bin/sh
#
# Created by configure

CC="clang"; export CC
CXX="clang++"; export CXX
NM=""; export NM
"../configure" \
"--enable-experimental-plugins" \
"--enable-example-plugins" \
"--enable-expensive-tests" \
"--prefix=/tmp/ats/" \
"--enable-werror" \
"--enable-ccache" \
"--enable-asan" \
"CC=clang" \
"CXX=clang++" \
"$@"
ywkaras commented 1 year ago

OK I was able to reproduce using clang on Ubuntu.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.