Skip to content

Commit

Permalink
skip pdeathsigger for versions
Browse files Browse the repository at this point in the history
  • Loading branch information
slicklash committed Sep 4, 2024
1 parent 6588841 commit 664141c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 0 additions & 2 deletions executable.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ RUN if grep -q "CentOS Linux 7" /etc/os-release ; then \
RUN ./node_builder_glibc_env.sh
COPY scripts/build_node_package.sh .
RUN ./build_node_package.sh

# needed for hadolint
WORKDIR /app
USER 1001
Expand Down Expand Up @@ -264,7 +263,6 @@ COPY --from=async-profiler-builder-musl /tmp/async-profiler/build/lib/libasyncPr
COPY --from=node-package-builder-musl /tmp/module_build gprofiler/resources/node/module/musl
COPY --from=node-package-builder-glibc /tmp/module_build gprofiler/resources/node/module/glibc


COPY --from=burn-builder /tmp/burn/burn gprofiler/resources/burn

COPY gprofiler gprofiler
Expand Down
4 changes: 3 additions & 1 deletion gprofiler/metadata/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def get_exe_version(
exe_path = f"/proc/{get_process_nspid(process.pid)}/exe"

def _run_get_version() -> "CompletedProcess[bytes]":
return run_process([exe_path, version_arg], stop_event=stop_event, timeout=get_version_timeout)
return run_process(
[exe_path, version_arg], stop_event=stop_event, timeout=get_version_timeout, pdeathsigger=False
)

try:
cp = run_in_ns(["pid", "mnt"], _run_get_version, process.pid)
Expand Down
1 change: 1 addition & 0 deletions gprofiler/profilers/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def _run_java_version() -> "CompletedProcess[bytes]":
],
stop_event=stop_event,
timeout=_JAVA_VERSION_TIMEOUT,
pdeathsigger=False,
)

# doesn't work without changing PID NS as well (I'm getting ENOENT for libjli.so)
Expand Down
1 change: 1 addition & 0 deletions gprofiler/profilers/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def _run_python_process_in_ns() -> "CompletedProcess[bytes]":
[python_path, "-S", "-c", "import sys; print(sys.maxunicode)"],
stop_event=self._stop_event,
timeout=self._PYTHON_TIMEOUT,
pdeathsigger=False,
)

return run_in_ns(["pid", "mnt"], _run_python_process_in_ns, process.pid).stdout.decode().strip()
Expand Down
2 changes: 1 addition & 1 deletion gprofiler/utils/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def is_rw_exec_dir(path: Path) -> bool:

# try executing
try:
run_process([str(test_script)], suppress_log=True)
run_process([str(test_script)], suppress_log=True, pdeathsigger=False)
except PermissionError:
# noexec
return False
Expand Down
9 changes: 5 additions & 4 deletions tests/test_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,12 @@ def _filter_record(r: LogRecord) -> bool:
# find the log record of
# Running command (command=['/app/gprofiler/resources/java/apsprof', '<PID>', 'load',
# '/path/to/libasyncProfiler.so', 'true', 'start,...'])
command = log_record_extra(r).get("command", [])
return (
r.message == "Running command"
and len(log_record_extra(r)["command"]) == 6
and log_record_extra(r)["command"][2] == "load"
and any(map(lambda k: k in log_record_extra(r)["command"][5], ["start,", "stop,"]))
and len(command) == 7
and command[3] == "load"
and any(map(lambda k: k in command[6], ["start,", "stop,"]))
)

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

Expand Down

0 comments on commit 664141c

Please sign in to comment.