datanucleus / datanucleus-api-jdo

Support for DataNucleus persistence using the JDO API (JSR0012, JSR0243)
18 stars 27 forks source link

missing isConfigurable() check in critical section #100

Closed ls-urs-keller closed 5 years ago

ls-urs-keller commented 5 years ago

see #99

andyjefferson commented 5 years ago

Since there is already a check on isConfigurable in that method, then no, on the face of it I don't see why there needs to be yet another check.

ls-urs-keller commented 5 years ago

Since there is already a check on isConfigurable in that method, then no, on the face of it I don't see why there needs to be yet another check.

Assume two threads T1 and T2. T1 runs freezeConfiguration and gets suspended just before the synchronized block (line 832) T2 runs freezeConfiguration and enters the synchronized block T1 resumes and gets blocked on the synchronized block T2 exits the synchronized block T1 resumes and since the check is missing runs the initialization a second time.

I actually have this in real world code.

andyjefferson commented 5 years ago

Suggest that you actually go back to your "issue" and add all of that to the "problem description". Without it, people won't know WHY you think something is needed. Once you have defined the problem then a PR makes more sense.

FWIW it is possible to sync the creation of a PMF hence why nobody else has seen that problem.