Skip to content

Commit 19f72c8

Browse files
committed
memory-leak: upgrade to debian 12
1 parent 743d9ae commit 19f72c8

File tree

3 files changed

+38
-54
lines changed

3 files changed

+38
-54
lines changed

.memory_leak/Dockerfile

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:12.9 as libjwt-builder
1+
FROM debian:12.9
22

33
WORKDIR /home/app
44
RUN apt update
@@ -13,17 +13,48 @@ RUN git clone --depth 1 --branch v3.2.0 https://github.com/benmcollins/libjwt.gi
1313
mkdir libjwt/build && \
1414
cd libjwt/build && cmake .. && make && make install
1515

16-
FROM openresty/openresty:1.25.3.2-3-bullseye-valgrind
1716

18-
RUN apt update
19-
RUN apt install -y cpanminus valgrind libjansson-dev
17+
## install openresty-valgrind
18+
19+
RUN DEBIAN_FRONTEND=noninteractive apt update \
20+
&& DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
21+
ca-certificates \
22+
gettext-base \
23+
gnupg2 \
24+
lsb-base \
25+
lsb-release \
26+
software-properties-common \
27+
wget gnupg ca-certificates
28+
RUN wget -qO - "https://openresty.org/package/pubkey.gpg" | gpg --dearmor > /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
29+
&& chown root:root /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
30+
&& chmod ugo+r /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
31+
&& chmod go-w /etc/apt/trusted.gpg.d/openresty-keyring.gpg \
32+
&& echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/openresty-keyring.gpg] https://openresty.org/package/debian $(grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release) openresty" | tee /etc/apt/sources.list.d/openresty.list
33+
34+
ENV PATH="$PATH:/usr/local/openresty-valgrind/luajit/bin:/usr/local/openresty-valgrind/nginx/sbin:/usr/local/openresty-valgrind/bin"
35+
36+
37+
# Use SIGQUIT instead of default SIGTERM to cleanly drain requests
38+
# See https://github.com/openresty/docker-openresty/blob/master/README.md#tips--pitfalls
39+
STOPSIGNAL SIGQUIT
40+
41+
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
42+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
43+
openresty-valgrind valgrind
44+
45+
RUN mkdir -p /var/run/openresty \
46+
&& ln -sf /dev/stdout /usr/local/openresty-valgrind/nginx/logs/access.log \
47+
&& ln -sf /dev/stderr /usr/local/openresty-valgrind/nginx/logs/error.log
48+
49+
RUN DEBIAN_FRONTEND=noninteractive apt update \
50+
&& DEBIAN_FRONTEND=noninteractive apt install -y cpanminus valgrind libjansson-dev
51+
2052
RUN cpanm -v --notest Test::Nginx
2153
2254
COPY ./lib/resty/libjwt /usr/local/openresty/lualib/resty/libjwt
2355
COPY ./lib/resty/libjwt /usr/local/openresty-valgrind/lualib/resty/libjwt
24-
COPY --from=libjwt-builder /usr/local/lib/libjwt.so /usr/local/lib/libjwt.so
25-
RUN ldconfig
2656
57+
WORKDIR /
2758
COPY ./.memory_leak/test /t
2859
COPY ./.memory_leak/valgrind.suppress /valgrind.suppress
2960
COPY ./.memory_leak/valgrind.awk /valgrind.awk

.memory_leak/valgrind.suppress

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
{
2-
<insert_a_suppression_name_here>
3-
Memcheck:Param
4-
epoll_ctl(event)
5-
fun:epoll_ctl
6-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
7-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
8-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
9-
fun:ngx_single_process_cycle
10-
fun:main
11-
}
121
{
132
<insert_a_suppression_name_here>
143
Memcheck:Leak
@@ -19,39 +8,3 @@
198
fun:ngx_single_process_cycle
209
fun:main
2110
}
22-
{
23-
<insert_a_suppression_name_here>
24-
Memcheck:Param
25-
epoll_ctl(event)
26-
fun:epoll_ctl
27-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
28-
fun:ngx_handle_read_event
29-
fun:ngx_http_init_connection
30-
fun:ngx_event_accept
31-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
32-
fun:ngx_process_events_and_timers
33-
fun:ngx_single_process_cycle
34-
fun:main
35-
}
36-
{
37-
<insert_a_suppression_name_here>
38-
Memcheck:Param
39-
epoll_ctl(event)
40-
fun:epoll_ctl
41-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
42-
fun:ngx_handle_read_event
43-
fun:ngx_http_lua_pipe_add_signal_handler
44-
fun:ngx_http_lua_init_worker
45-
fun:ngx_single_process_cycle
46-
fun:main
47-
}
48-
{
49-
<insert_a_suppression_name_here>
50-
Memcheck:Param
51-
epoll_ctl(event)
52-
fun:epoll_ctl
53-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
54-
obj:/usr/local/openresty-valgrind/nginx/sbin/nginx
55-
fun:ngx_single_process_cycle
56-
fun:main
57-
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test.e2e:
2121
@go test -v ./...
2222

2323
test.memory_leak:
24-
@docker compose --profile memory_leak up --build --abort-on-container-exit
24+
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker compose --profile memory_leak up --build --abort-on-container-exit --no-log-prefix
2525

2626
lint:
2727
luacheck --std ngx_lua ./lib/

0 commit comments

Comments
 (0)