Skip to content

Commit 2fb9611

Browse files
committed
skip pdeathsigger for versions
1 parent 6588841 commit 2fb9611

6 files changed

Lines changed: 12 additions & 9 deletions

File tree

executable.Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ RUN if grep -q "CentOS Linux 7" /etc/os-release ; then \
212212
RUN ./node_builder_glibc_env.sh
213213
COPY scripts/build_node_package.sh .
214214
RUN ./build_node_package.sh
215-
216215
# needed for hadolint
217216
WORKDIR /app
218217
USER 1001
@@ -264,7 +263,6 @@ COPY --from=async-profiler-builder-musl /tmp/async-profiler/build/lib/libasyncPr
264263
COPY --from=node-package-builder-musl /tmp/module_build gprofiler/resources/node/module/musl
265264
COPY --from=node-package-builder-glibc /tmp/module_build gprofiler/resources/node/module/glibc
266265

267-
268266
COPY --from=burn-builder /tmp/burn/burn gprofiler/resources/burn
269267

270268
COPY gprofiler gprofiler

gprofiler/metadata/versions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def get_exe_version(
3535
exe_path = f"/proc/{get_process_nspid(process.pid)}/exe"
3636

3737
def _run_get_version() -> "CompletedProcess[bytes]":
38-
return run_process([exe_path, version_arg], stop_event=stop_event, timeout=get_version_timeout)
38+
return run_process(
39+
[exe_path, version_arg], stop_event=stop_event, timeout=get_version_timeout, pdeathsigger=False
40+
)
3941

4042
try:
4143
cp = run_in_ns(["pid", "mnt"], _run_get_version, process.pid)

gprofiler/profilers/java.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ def _run_java_version() -> "CompletedProcess[bytes]":
350350
],
351351
stop_event=stop_event,
352352
timeout=_JAVA_VERSION_TIMEOUT,
353+
pdeathsigger=False,
353354
)
354355

355356
# doesn't work without changing PID NS as well (I'm getting ENOENT for libjli.so)

gprofiler/profilers/python.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def _run_python_process_in_ns() -> "CompletedProcess[bytes]":
137137
[python_path, "-S", "-c", "import sys; print(sys.maxunicode)"],
138138
stop_event=self._stop_event,
139139
timeout=self._PYTHON_TIMEOUT,
140+
pdeathsigger=False,
140141
)
141142

142143
return run_in_ns(["pid", "mnt"], _run_python_process_in_ns, process.pid).stdout.decode().strip()

gprofiler/utils/fs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def is_rw_exec_dir(path: Path) -> bool:
5757

5858
# try executing
5959
try:
60-
run_process([str(test_script)], suppress_log=True)
60+
run_process([str(test_script)], suppress_log=True, pdeathsigger=False)
6161
except PermissionError:
6262
# noexec
6363
return False

tests/test_java.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,12 @@ def _filter_record(r: LogRecord) -> bool:
486486
# find the log record of
487487
# Running command (command=['/app/gprofiler/resources/java/apsprof', '<PID>', 'load',
488488
# '/path/to/libasyncProfiler.so', 'true', 'start,...'])
489+
command = log_record_extra(r).get("command", [])
489490
return (
490491
r.message == "Running command"
491-
and len(log_record_extra(r)["command"]) == 6
492-
and log_record_extra(r)["command"][2] == "load"
493-
and any(map(lambda k: k in log_record_extra(r)["command"][5], ["start,", "stop,"]))
492+
and len(command) == 7
493+
and command[3] == "load"
494+
and any(map(lambda k: k in command[6], ["start,", "stop,"]))
494495
)
495496

496497
return list(filter(_filter_record, records))
@@ -567,7 +568,7 @@ def test_java_noexec_or_ro_dirs(
567568
assert len(jattach_loads) == 2
568569
# 3rd part of commandline to AP - shall begin with POSSIBLE_AP_DIRS[1]
569570
assert all(
570-
log_record_extra(jl)["command"][3].startswith(f"{gprofiler.profilers.java.POSSIBLE_AP_DIRS[1]}/async-profiler-")
571+
log_record_extra(jl)["command"][4].startswith(f"{gprofiler.profilers.java.POSSIBLE_AP_DIRS[1]}/async-profiler-")
571572
for jl in jattach_loads
572573
)
573574

@@ -616,7 +617,7 @@ def test_java_symlinks_in_paths(
616617
# 2 entries - start and stop
617618
assert len(jattach_loads) == 2
618619
# 3rd part of commandline to AP - shall begin with the final, resolved path.
619-
assert all(log_record_extra(jl)["command"][3].startswith("/run/final_tmp/gprofiler_tmp/") for jl in jattach_loads)
620+
assert all(log_record_extra(jl)["command"][4].startswith("/run/final_tmp/gprofiler_tmp/") for jl in jattach_loads)
620621

621622

622623
@pytest.mark.parametrize("in_container", [True]) # only in container is enough

0 commit comments

Comments
 (0)