Skip to content

Commit

Permalink
Merge pull request #72 from minnerbe/fix/hang-empty-collection
Browse files Browse the repository at this point in the history
Fix potential hang when exceptions are thrown during concurrent optimization
  • Loading branch information
axtimwalde authored Oct 29, 2024
2 parents 35ea550 + 0819849 commit ba36e15
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mpicbg/src/main/java/mpicbg/models/TileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,13 @@ private static Void fitAndApplyWorker(
final boolean canBeProcessed = Collections.disjoint(tile.getConnectedTiles(), executingTiles);

if (canBeProcessed) {
tile.fitModel();
tile.apply(damp);
executingTiles.remove(tile);
try {
tile.fitModel();
tile.apply(damp);
} finally {
// clean up if there was an exception, otherwise this can cause a deadlock
executingTiles.remove(tile);
}
} else {
executingTiles.remove(tile);
pendingTiles.addLast(tile);
Expand Down

0 comments on commit ba36e15

Please sign in to comment.