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

utils: perf: Catch another case of perf permissions error #353

Merged
merged 2 commits into from
May 2, 2022

Conversation

Jongy
Copy link
Contributor

@Jongy Jongy commented Apr 29, 2022

[17:21:12] Couldn't create the Java profiler, continuing without it
Traceback (most recent call last):
  File "gprofiler/profilers/factory.py", line 41, in get_profilers
  File "gprofiler/profilers/java.py", line 637, in __init__
  File "gprofiler/profilers/java.py", line 654, in _init_ap_mode
  File "gprofiler/utils/perf.py", line 19, in can_i_use_perf_events
  File "gprofiler/utils/__init__.py", line 265, in run_process
gprofiler.exceptions.CalledProcessError: Command '['/tmp/_MEIYxgsVy/gprofiler/resources/perf', 'record', '-o', '/dev/null', '--', '/bin/true']' returned non-zero exit status 255.
stdout: b''
stderr: b'Permission error mapping pages.\nConsider increasing /proc/sys/kernel/perf_event_mlock_kb,\nor try again with a smaller value of -m/--mmap_pages.\n(current value: 4294967295,0)\n'

I don't know, maybe it's just best to catch all errors and treat them as "False" instead of failing the JavaProfiler completely. On the other hand, that might hide real errors. Well, keeping it this way for now.

	[17:21:12] Couldn't create the Java profiler, continuing without it
	Traceback (most recent call last):
	  File "gprofiler/profilers/factory.py", line 41, in get_profilers
	  File "gprofiler/profilers/java.py", line 637, in __init__
	  File "gprofiler/profilers/java.py", line 654, in _init_ap_mode
	  File "gprofiler/utils/perf.py", line 19, in can_i_use_perf_events
	  File "gprofiler/utils/__init__.py", line 265, in run_process
	gprofiler.exceptions.CalledProcessError: Command '['/tmp/_MEIYxgsVy/gprofiler/resources/perf', 'record', '-o', '/dev/null', '--', '/bin/true']' returned non-zero exit status 255.
	stdout: b''
	stderr: b'Permission error mapping pages.\nConsider increasing /proc/sys/kernel/perf_event_mlock_kb,\nor try again with a smaller value of -m/--mmap_pages.\n(current value: 4294967295,0)\n'
@Jongy Jongy added the bug Something isn't working label Apr 29, 2022
@Jongy Jongy requested a review from adi-benz April 29, 2022 13:18
@adi-benz
Copy link
Contributor

adi-benz commented May 1, 2022

I don't know, maybe it's just best to catch all errors and treat them as "False" instead of failing the JavaProfiler completely. On the other hand, that might hide real errors. Well, keeping it this way for now.

What about changing it to return False and logging the error?

@Jongy
Copy link
Contributor Author

Jongy commented May 1, 2022

I don't know, maybe it's just best to catch all errors and treat them as "False" instead of failing the JavaProfiler completely. On the other hand, that might hide real errors. Well, keeping it this way for now.

What about changing it to return False and logging the error?

Yes, let's do that

gprofiler/utils/perf.py Show resolved Hide resolved
@Jongy Jongy requested a review from adi-benz May 2, 2022 08:28
@Jongy Jongy merged commit 992a30a into master May 2, 2022
@Jongy Jongy deleted the can-i-use-perf-fix branch May 2, 2022 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants