Skip to content

Commit 46ecc54

Browse files
authored
Merge pull request #5349 from garlick/sdexec_leak
sdexec: fix memory leaks
2 parents 823b8a1 + 8a26e79 commit 46ecc54

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

src/common/libsdexec/parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ int sdexec_parse_bitmap (const char *s, uint8_t **bp, size_t *sp)
7171
BITMAP_BYTE (bitmap, id) |= BITMAP_BIT (id);
7272
id = idset_next (ids, id);
7373
}
74-
idset_destroy (ids);
7574
}
7675
*bp = bitmap;
7776
*sp = BITMAP_NBYTES (nbits);
77+
idset_destroy (ids);
7878
return 0;
7979
}
8080

src/modules/sdexec/sdexec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ static void sdproc_destroy (struct sdproc *proc)
390390
{
391391
if (proc) {
392392
int saved_errno = errno;
393+
sdexec_channel_destroy (proc->in);
393394
sdexec_channel_destroy (proc->out);
394395
sdexec_channel_destroy (proc->err);
395396
if (proc->f_watch) {
@@ -801,7 +802,7 @@ static void list_cb (flux_t *h,
801802
}
802803
if (flux_respond_pack (h,
803804
msg,
804-
"{s:i s:o}",
805+
"{s:i s:O}",
805806
"rank", ctx->rank,
806807
"procs", procs) < 0)
807808
flux_log_error (h, "error responding to list request");

t/t5000-valgrind.t

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,18 @@ VALGRIND_WORKLOAD=${SHARNESS_TEST_SRCDIR}/valgrind/valgrind-workload.sh
4040

4141
VALGRIND_NBROKERS=${VALGRIND_NBROKERS:-2}
4242

43+
# Allow jobs to run under sdexec in test, if available
44+
cat >valgrind.toml <<-EOT
45+
[exec]
46+
service-override = true
47+
EOT
48+
4349
test_expect_success \
4450
"valgrind reports no new errors on $VALGRIND_NBROKERS broker run" '
4551
run_timeout 300 \
4652
flux start -s ${VALGRIND_NBROKERS} \
4753
--test-exit-timeout=120 \
54+
-o,--config-path=valgrind.toml \
4855
--wrap=libtool,e,${VALGRIND} \
4956
--wrap=--tool=memcheck \
5057
--wrap=--leak-check=full \

t/valgrind/workload.d/job-sdexec

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
if ! flux version | grep systemd; then
2+
echo "flux was not built with systemd"
3+
exit 0
4+
fi
5+
if ! systemctl --user show --property Version; then
6+
echo "user systemd is not running"
7+
exit 0
8+
fi
9+
if ! busctl --user status >/dev/null; then
10+
echo "user dbus is not running"
11+
exit 0
12+
fi
13+
14+
flux module load sdbus
15+
flux module load sdexec
16+
17+
NJOBS=${NJOBS:-10}
18+
19+
for i in `seq 1 ${NJOBS}`
20+
do
21+
flux submit --wait \
22+
--setattr system.exec.bulkexec.service=sdexec \
23+
${SHARNESS_TEST_DIRECTORY}/shell/lptest 78 2
24+
done
25+
26+
flux module remove sdexec
27+
flux module remove sdbus

0 commit comments

Comments
 (0)