Skip to content
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

[incubator-kie-drools-5974] Possible deadlock with KieRepositoryImpl$… #6006

Merged

Conversation

tkobayas
Copy link
Contributor

@tkobayas
Copy link
Contributor Author

I fixed 7.x with a smaller change (lock order) kiegroup#56

But for main, I introduced ReentrantLock which is more explicit.

Comment on lines +143 to +151
// share the lock between KieModuleRepo and KieRepository
final Field KieModuleRepoLockField = KieModuleRepo.class.getDeclaredField("lock");
KieModuleRepoLockField.setAccessible(true);
Object lock = KieModuleRepoLockField.get(kieModuleRepo);
KieModuleRepoLockField.setAccessible(false);
final Field kieRepositoryImplLockField = KieRepositoryImpl.class.getDeclaredField("lock");
kieRepositoryImplLockField.setAccessible(true);
kieRepositoryImplLockField.set(kieRepository, lock);
kieRepositoryImplLockField.setAccessible(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This reflection is a little ugly, but reflection was already used in this test, so I followed the approach rather than introducing public accessor for lock.

@tkobayas
Copy link
Contributor Author

tkobayas commented Jul 1, 2024

@mariofusco @lucamolteni Please review, thanks!

@mariofusco mariofusco merged commit 1ab862d into apache:main Jul 8, 2024
10 checks passed
rgdoliveira pushed a commit to rgdoliveira/drools that referenced this pull request Jul 8, 2024
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.

Possible deadlock with KieRepositoryImpl$KieModuleRepo and KieRepositoryScannerImpl
3 participants