Skip to content

Make parallel model imports thread-safe - #602

Merged
balhoff merged 1 commit into
masterfrom
issue-572
Jul 30, 2026
Merged

balhoff merged 1 commit into
masterfrom
issue-572

Conversation

@balhoff

@balhoff balhoff commented Jul 29, 2026

Copy link
Copy Markdown
Member

Fixes #572.

@balhoff

balhoff commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

I'd like to test this locally a bit more before merging.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses intermittent failures during parallel OWL model imports in the Minerva CLI by replacing non-thread-safe shared collections used inside parallelStream() pipelines, aligning with the ClassCastException reported in #572.

Changes:

  • Replace a shared HashSet used during --import-owl-models with a concurrent key-set to make parallel duplicate tracking thread-safe.
  • Replace HashMap-based duplicate tracking in --validate-go-cams with a concurrent map and use putIfAbsent to detect duplicate IRIs safely in parallel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (i.isDirectory()) {
LOGGER.info("Loading models from " + i.getAbsolutePath());
Set<String> model_iris = new HashSet<String>();
FileUtils.listFiles(i, null, true).parallelStream().parallel().forEach(file -> {
Comment on lines +966 to +969
String existingFile = modelid_filename.putIfAbsent(modeluri, file.getName());
if (existingFile != null) {
LOGGER.error("Multiple models with same IRI: " + modeluri + " file: " + file + " file: " + existingFile);
}
@balhoff
balhoff merged commit 6b4bb11 into master Jul 30, 2026
2 checks passed
@balhoff
balhoff deleted the issue-572 branch July 30, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Under some unknown and random circumstances, the minerva shell command fails with an error

2 participants