-
Notifications
You must be signed in to change notification settings - Fork 22
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
test_sbom_details_cyclonedx_osv
cause stack overflow errors
#1322
Comments
can we close this ? 👍 |
has relation with #1344 but I'm not sure if that is the same |
That PR simply hides this issue, but doesn't resolve it. |
I think I found the places where stack overflows occur, they are commented together, as it is a stack error that must be at the limit... un-commenting one or the other will cause the error. The cause may be these functions or other previous ones that used up stack space. As you can see now I have assertion error: ──── STDERR: trustify-module-fundamental::fundamental sbom::details::sbom_details_cyclonedx_osv
thread 'sbom::details::sbom_details_cyclonedx_osv' panicked at modules/fundamental/tests/sbom/details.rs:90:5:
assertion `left == right` failed
left: 11
right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Cancelling due to test failure
────────────
Summary [ 1.358s] 1 test run: 0 passed, 1 failed, 389 skipped
FAIL [ 1.348s] trustify-module-fundamental::fundamental sbom::details::sbom_details_cyclonedx_osv
error: test run failed ➜ trustify git:(test-stack) ✗ git diff
diff --git a/modules/fundamental/tests/sbom/details.rs b/modules/fundamental/tests/sbom/details.rs
index 6f093e27..93fefce7 100644
--- a/modules/fundamental/tests/sbom/details.rs
+++ b/modules/fundamental/tests/sbom/details.rs
@@ -12,13 +12,13 @@ use trustify_test_context::TrustifyContext;
#[instrument]
async fn sbom_details_cyclonedx_osv(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
// get the env var RUST_MIN_STACK and make sure it set to 50000000
- let stack_size = env::var("RUST_MIN_STACK").unwrap_or("".to_string());
- if stack_size != "50000000" {
- println!(
- "skipping sbom_details_cyclonedx_osv test, RUST_MIN_STACK=50000000 env var is not set"
- );
- return Ok(());
- }
+ // let stack_size = env::var("RUST_MIN_STACK").unwrap_or("".to_string());
+ // if stack_size != "50000000" {
+ // println!(
+ // "skipping sbom_details_cyclonedx_osv test, RUST_MIN_STACK=50000000 env var is not set"
+ // );
+ // return Ok(());
+ // }
let sbom = SbomService::new(ctx.db.clone());
diff --git a/modules/ingestor/src/graph/sbom/cyclonedx.rs b/modules/ingestor/src/graph/sbom/cyclonedx.rs
index 56884363..655547d4 100644
--- a/modules/ingestor/src/graph/sbom/cyclonedx.rs
+++ b/modules/ingestor/src/graph/sbom/cyclonedx.rs
@@ -145,22 +145,22 @@ impl SbomContext {
.as_ref()
.map(|cpe| Cpe::from_str(cpe.as_ref()))
.transpose()?;
- let pr = self
- .graph
- .ingest_product(
- component.name.clone(),
- ProductInformation {
- vendor: component.publisher.clone().map(|p| p.to_string()),
- cpe: product_cpe,
- },
- connection,
- )
- .await?;
-
- if let Some(ver) = component.version.clone() {
- pr.ingest_product_version(ver.to_string(), Some(self.sbom.sbom_id), connection)
- .await?;
- }
+ // let pr = self
+ // .graph
+ // .ingest_product(
+ // component.name.clone(),
+ // ProductInformation {
+ // vendor: component.publisher.clone().map(|p| p.to_string()),
+ // cpe: product_cpe,
+ // },
+ // connection,
+ // )
+ // .await?;
+
+ // if let Some(ver) = component.version.clone() {
+ // pr.ingest_product_version(ver.to_string(), Some(self.sbom.sbom_id), connection)
+ // .await?;
+ // }
// create component
@@ -199,7 +199,7 @@ impl SbomContext {
// create
- creator.create(connection, &mut processors).await?;
+ // creator.create(connection, &mut processors).await?;
// done |
We have recursion here |
Good find! I think you could try to "box" it (putting it on the heap). Something like: let creator = Box::new(creator); Maybe that's the trick. |
test_sbom_details_cyclonedx_osv
causes a stack overflow:The text was updated successfully, but these errors were encountered: