The problem is easily reproducible using replication (see test case) but may also exists on standalone instance.
There is a thread responsible to rebuild cos cache when it is notified that a cos definition was updated. To do so this thread, holding the notification lock, will rebuild the cache reading the definitions (on backend) trying to acquire db page.
A thread that updates a cos definition will notify the first thread. The update acquire db page and tries to acquire notification lock.
This is a scenario of deadlock because of locks taken in the opposite order.
attachment ticket49079_test.py
attachment 0001-Ticket-49079-deadlock-on-cos-cache-rebuild.patch
A small note, is cos_cache_create_unloc()? meant to be cos_cache_create_unlock()?
Otherwise, I can understand the fix and how it works, it seems reasonable. I'm wondering if there is a cleaner way to achieve this with reordering of the backend lock compared to the change_lock, or with monitors.
Regardless, I think this solution will work,
attachment 0002-Ticket-49079-deadlock-on-cos-cache-rebuild.patch
Thanks William and Ludwig for the reviews
'''git push origin master''' Counting objects: 7, done. Delta compression using up to 8 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.90 KiB | 0 bytes/s, done. Total 7 (delta 4), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git 9feca58..ac44337 master -> master
commit ac44337 Author: Thierry Bordaz tbordaz@redhat.com Date: Tue Jan 10 14:32:53 2017 +0100
Pushed to 389-ds-base-1.3.5: 79a3dea..3ac12cb 389-ds-base-1.3.5 -> 389-ds-base-1.3.5 commit 3ac12cb
Metadata Update from @tbordaz: - Issue assigned to tbordaz - Issue set to the milestone: 1.3.6 backlog
Hey Thierry, is this issue now resolved? Would you like to close it?
Metadata Update from @firstyear: - Issue close_status updated to: None
Metadata Update from @tbordaz: - Issue close_status updated to: fixed - Issue status updated to: Closed (was: Open)
389-ds-base is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in 389-ds-base's github repository.
This issue has been cloned to Github and is available here: - https://github.com/389ds/389-ds-base/issues/2138
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.
Metadata Update from @spichugi: - Issue close_status updated to: wontfix (was: fixed)
Login to comment on this ticket.