Drools can deadlock when facts are inserted/retracted/modified in multiple entry
points in the same session. Since each such action will acquire the lock
associated with the entry point, it's possible for the order of calls to cause
deadlock when the locks for two entry points are acquired by two different
threads, then the change in working memory activates and executes rules which
also insert/retract/modify and thus require acquiring the lock for the other
entry point.
As far as I can tell, there is no way to prevent this kind of deadlock other
than using only one entry point. Can anyone think of others?
In my case, I'm using Drools Fusion with two different entry points for events.
Whenever events expire, the engine automatically retracts them, so there are
lots of opportunities for the locks from each entry point to be acquired after
already holding the other entry point's lock. I used two different entry points
to separate different types of events for code clarity, so it's a simple
workaround in my application to consolidate all my events to use a single entry
point.
I can't think of a compelling reason for employing different entry points, so
maybe this isn't a big issue. But it would be good to know if there is another
way of preventing deadlock with multiple entry points.
Thanks,
Norman
Show replies by date