Skip to content

CacheStampedeBlocker JSONObject exception #2456

Closed

Description

@valentijnscholten

Current Behavior

Logs contain lots of errors trying to populate metadata cache:

2023-02-04 10:54:14,609 ERROR [CacheStampedeBlocker] An error occurred while populating cache repositoryMetaCache for key pkg:composer/magento/[email protected] : JSONObject["magento/module-developer"] not found.

Steps to Reproduce

Upload some SBOMS with magento modules/components such as magento/module-developer.
Wait for Metadata update jobs to complete
Observe log

Expected Behavior

It looks like its a common scenario to not being able to retrieve metadata for some components, so this should be handled more gracefully. Maybe lower to WARN or even INFO/DEBUG. Similar to what was done in #2134
Also currently the details of the exception are swallowed.
I haven't deduced yet the exact spot where this JSONObject not found error occurs.
There are 2 places where this log line is generated:

} catch (Exception e) {
LOGGER.error("An error occurred while populating cache "+cacheName+" for key "+key+" : "+e.getMessage());
if (cachePopulationFuture != null && !cachePopulationFuture.future.isDone()) {
cachePopulationFuture.getFuture().completeExceptionally(e);
cacheLoaders.remove(key);
}
return Optional.empty();
} finally {

} catch (InterruptedException| ExecutionException e) {
LOGGER.error("An error occurred while populating cache "+cacheName+" for key "+key+" : "+e.getMessage());
return Optional.empty();
}

Dependency-Track Version

4.7.1

Dependency-Track Distribution

Container Image

Database Server

PostgreSQL

Database Server Version

No response

Browser

Google Chrome

Checklist

Activity

  1. added
    defect
    on Feb 6, 2023
  2. added this to the 4.8 milestone on Feb 6, 2023
  3. nscuro commented on Feb 6, 2023

    @nscuro
    Member

    I remember we had a Slack discussion about properly handling 404s / "package not found" cases instead of letting them run into the default exception handling. We should definitely get this sorted. Thanks for reporting.

  4. valentijnscholten commented on Feb 6, 2023

    @valentijnscholten
    ContributorAuthor

    should maybe be en ehancement request instead of defect.

  5. added
    enhancement
    and removed
    defect
    on Feb 6, 2023
  6. added
    p3
    on Feb 6, 2023
  7. valentijnscholten commented on Feb 7, 2023

    @valentijnscholten
    ContributorAuthor

    I think this will be resolved by #2327 which is not yet released. I was confused because A) I thought the fix was already released B) In 4.7.x the exception occurs in a different class which didn't sound familiar.

  8. nscuro commented on Feb 7, 2023

    @nscuro
    Member

    #2327 only addressed Composer, not any of the other repo analyzers. So still a valid issue.

  9. valentijnscholten commented on Feb 8, 2023

    @valentijnscholten
    ContributorAuthor

    The reason I became aware of this is because this exception caused excessive retries to be done by the CacheStampedeBlocker saturating the worker threads for a long time.

  10. added a commit that references this issue on Mar 24, 2023
  11. added a commit that references this issue on Apr 6, 2023
  12. nscuro commented on Apr 10, 2023

    @nscuro
    Member

    Resolved in #2563

  13. added a commit that references this issue on Apr 12, 2023
  14. github-actions commented on May 11, 2023

    @github-actions
    Contributor

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  15. locked as resolved and limited conversation to collaborators on May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementp3

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions