Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE: Investigate memory leaks by inspecting heap #2194

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ COPY --from=journal /sysroot /
# Copy mount script for mounting host partitions into container
COPY mount-partitions.sh .

COPY profile.sh .

# Runtime dependencies
RUN apk add --update --no-cache \
$NODE \
Expand Down
2 changes: 1 addition & 1 deletion entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ if [ "${LIVEPUSH}" = "1" ]; then
exec npx nodemon --watch src --watch typings --ignore tests -e js,ts,json \
--exec node -r ts-node/register/transpile-only src/app.ts
else
exec node /usr/src/app/dist/app.js
exec node --heapsnapshot-signal=SIGUSR2 /usr/src/app/dist/app.js
fi
13 changes: 13 additions & 0 deletions profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -o errexit

SUPERVISOR_PID=1
# Snapshot interval in seconds (default: 3600s = 1h)
INTERVAL="${INTERVAL:-3600}"

# Send a SIGUSR2 signal to the supervisor process once every INTERVAL
while true; do
kill -USR2 "${SUPERVISOR_PID}"
sleep "${INTERVAL}"
done
8 changes: 8 additions & 0 deletions test/lib/wait-for-it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,19 @@ abort_if_not_ready() {
exit 1
}

abort_if_stopped() {
echo "Interrupted from external signal" >&2
kill "$timer_pid"
exit 1
}

# Trap the signal and start the timer if user timeout is greater than 0
if [ "$timeout" -gt 0 ]; then
trap 'abort_if_not_ready' USR2
set_abort_timer "$timeout" $$ &
timer_pid=$!
# Fail if a signal stops the script
trap 'abort_if_stopped' INT TERM
fi

# Wait for docker
Expand Down