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

v0.5: Using regex filter causes Scaphandre to panic #295

Closed
olepbr opened this issue Apr 2, 2023 · 2 comments
Closed

v0.5: Using regex filter causes Scaphandre to panic #295

olepbr opened this issue Apr 2, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@olepbr
Copy link

olepbr commented Apr 2, 2023

Bug description

Attempting to use the stdout exporter's regex filter (-r) causes Scaphandre to panic and exit. Backtrace:

⚘ ~/dev/rust/scaphandre RUST_BACKTRACE=1 ./target/debug/scaphandre stdout -r chromium                                                                                                                          [101]
Scaphandre stdout exporter
Sending ⚡ metrics
Measurement step is: 2s
Host:	0 W
	package 	core		dram		uncore
Processes filtered by 'chromium':
Power		PID	Exe
No processes found yet or filter returns no value.
------------------------------------------------------------

Host:	2.072913 W
	package 	core		dram		uncore
Socket0	2.072913 W |	0.61677 W	0.438338 W	0.007717 W	

Processes filtered by 'chromium':
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PermissionDenied(None)', src/sensors/utils.rs:302:48
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:577:5
   1: core::panicking::panic_fmt
             at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/result.rs:1690:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/result.rs:1092:23
   4: scaphandre::sensors::utils::IProcess::exe
             at ./src/sensors/utils.rs:302:28
   5: scaphandre::sensors::utils::ProcessTracker::get_filtered_processes
             at ./src/sensors/utils.rs:903:39
   6: scaphandre::exporters::stdout::StdoutExporter::show_metrics
             at ./src/exporters/stdout.rs:242:25
   7: scaphandre::exporters::stdout::StdoutExporter::iterate
             at ./src/exporters/stdout.rs:157:9
   8: scaphandre::exporters::stdout::StdoutExporter::runner
             at ./src/exporters/stdout.rs:140:17
   9: <scaphandre::exporters::stdout::StdoutExporter as scaphandre::exporters::Exporter>::run
             at ./src/exporters/stdout.rs:20:9
  10: scaphandre::run
             at ./src/lib.rs:89:9
  11: scaphandre::main
             at ./src/main.rs:89:5
  12: core::ops::function::FnOnce::call_once
             at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

To Reproduce

  1. scaphandre stdout -r foo
  2. Watch it panic.

Expected behavior

Scaphandre should output the list of processes matching the regex, if any.

Environment

  • Linux distribution version: Manjaro 22.1.0 (Talos)
  • Kernel version: 6.2.8-1-MANJARO

Additional context

This is fixed on dev due to the problematic implementation of IProcess.exe(&self) being removed in b18aaee. Obviously Scaphandre isn't "stable" software yet, but it would maybe be nice to release a new version which addresses this? (Provided that cutting a new release from dev isn't too much work.)

Cheers!

@olepbr olepbr added the bug Something isn't working label Apr 2, 2023
@TheElectronWill
Copy link
Contributor

Maybe a new label fixed-on-dev could be added for issues like this?

@bpetit
Copy link
Contributor

bpetit commented Jul 24, 2023

Hi,

Next release is close. In the mean time, would it be acceptable to use the dev version ?

@bpetit bpetit closed this as completed Jul 24, 2023
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
Status: Previous releases
Development

No branches or pull requests

3 participants