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

java: Fix regression _find_rw_exec_dir() failing to handle ro dirs #860

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

Jongy
Copy link
Contributor

@Jongy Jongy commented Nov 24, 2023

Fixes a regression from 6360449, and improves the tests
so we'd catch it next time :)

@Jongy Jongy added bug Something isn't working runtime/java labels Nov 24, 2023
@Jongy
Copy link
Contributor Author

Jongy commented Nov 24, 2023

I will also run one negative test - undo the fix and ensure that the new test fails.

Fixes a regression from 6360449, and improves the tests
so we'd catch it next time :)
@Jongy Jongy force-pushed the fix-find-rwexec-dir branch from 357755f to 6e323a2 Compare November 27, 2023 20:25
@Jongy
Copy link
Contributor Author

Jongy commented Nov 27, 2023

Commenting-out the fixing code in the plugin - the tests fail as expected.

tests/test_java.py::test_java_noexec_or_ro_dirs[on_host-noexec] PASSED                                                                                                                                                               [ 25%]
tests/test_java.py::test_java_noexec_or_ro_dirs[on_host-ro] FAILED                                                                                                                                                                   [ 50%]
tests/test_java.py::test_java_noexec_or_ro_dirs[in_container-noexec] PASSED                                                                                                                                                          [ 75%]
tests/test_java.py::test_java_noexec_or_ro_dirs[in_container-ro] FAILED
Traceback (most recent call last):
  File "/Granulate/gprofiler/gprofiler/profilers/profiler_base.py", line 132, in _wait_for_profiles
    result = future.result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    result = self.fn(*self.args, **self.kwargs)                                                                                                                                                                                    [98/1807]
  File "/Granulate/gprofiler/gprofiler/profilers/java.py", line 1211, in _profile_process
    with AsyncProfiledProcess(
  File "/Granulate/gprofiler/gprofiler/profilers/java.py", line 498, in __init__
    self._ap_dir_base = self._find_rw_exec_dir()
  File "/Granulate/gprofiler/gprofiler/profilers/java.py", line 545, in _find_rw_exec_dir
    mkdir_owned_root(full_dir)
  File "/Granulate/gprofiler/gprofiler/utils/fs.py", line 91, in mkdir_owned_root
    os.mkdir(path, mode=mode)
OSError: [Errno 30] Read-only file system: '/proc/1/root/tmp/pytest-of-root/pytest-22/test_java_noexec_or_ro_dirs_on1/tmpfs/gprofiler_tmp'

@Jongy Jongy requested a review from michelhe November 27, 2023 21:05
@Jongy Jongy merged commit 772ea13 into master Nov 29, 2023
28 checks passed
@Jongy Jongy deleted the fix-find-rwexec-dir branch November 29, 2023 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working runtime/java
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants