Skip to content

Commit

Permalink
Warn instead of crash when rlimits cannot be set
Browse files Browse the repository at this point in the history
Fixes #170.
  • Loading branch information
bradlarsen committed Apr 11, 2024
1 parent 947ee20 commit 285b3fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- The `vectorscan` and `vectorscan-sys` crates have been split off into a [separate project](https://github.com/bradlarsen/vectorscan-rs) with crates published on crates.io ([#168](https://github.com/praetorian-inc/noseyparker/pull/168)).

### Fixes

- Upon `noseyparker` startup, if resource limits cannot be adjusted, instead of crashing, a warning is printed and the process attempts to continue ([#170](https://github.com/praetorian-inc/noseyparker/issues/170)).


## [v0.17.0](https://github.com/praetorian-inc/noseyparker/releases/v0.17.0) (2024-03-05)

Expand Down
7 changes: 5 additions & 2 deletions crates/noseyparker-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use mimalloc::MiMalloc;
static GLOBAL: MiMalloc = MiMalloc;

use anyhow::{Context, Result};
use tracing::debug;
use tracing::{debug, warn};

mod args;
mod cmd_datastore;
Expand Down Expand Up @@ -94,7 +94,10 @@ fn try_main(args: &CommandLineArgs) -> Result<()> {
configure_backtraces(global_args);
configure_color(global_args);
configure_tracing(global_args).context("Failed to initialize logging")?;
configure_rlimits(global_args).context("Failed to initialize resource limits")?;

if let Err(e) = configure_rlimits(global_args) {
warn!("Failed to initialize resource limits: {e}");
}

match &args.command {
args::Command::Datastore(args) => cmd_datastore::run(global_args, args),
Expand Down
1 change: 1 addition & 0 deletions crates/noseyparker-cli/tests/test_noseyparker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ mod scan;
// TODO(test): add tests for enumerating GitHub Enterprise with the `--ignore-certs` optino
// TODO(test): add tests for `scan --git-url=URL --ignore-certs`
// TODO(test): add test case that validates `report -f json` output against the JSON schema (see the `jsonschema` crate)
// TODO(test) add test that failing to set rlimits at startup doesn't crash, but outputs a warning

0 comments on commit 285b3fb

Please sign in to comment.