Skip to content

CacheStampedeBlocker JSONObject exception #2456

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/module-developer@100.4.5 : 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestp3Nice-to-have features

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions