JetBrains / lincheck

Framework for testing concurrent data structures
Mozilla Public License 2.0
564 stars 33 forks source link

Bugfix for wait-notify support in presence of lock re-entrance #145

Closed eupp closed 1 year ago

eupp commented 1 year ago

In current implementation of MonitorTracker in model checking strategy, the monitor re-entrance information is lost when thread performs wait operation on some object. Thus upon wake-up the model checker just re-acquires a monitor once, but does not restore previous monitor re-entrance counter. This leads to a bug (see the new test added in this PR).

This PR fixes this problem by saving the information about lock re-entrance and then correctly restoring it.

eupp commented 1 year ago

@ndkoval could you please also have a look at this.