[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-6689) DefaultMergeEventListener changes CheckNullability flag - not thread save
Piotr Findeisen (JIRA)
noreply at atlassian.com
Fri Oct 28 05:07:23 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44192#comment-44192 ]
Piotr Findeisen edited comment on HHH-6689 at 10/28/11 4:07 AM:
----------------------------------------------------------------
Btw. it seems very probable that the sequence the following operations done in {{saveTransientEntity}} ([see source on github|https://github.com/hibernate/hibernate-core/blob/3.6/hibernate-core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java#L407])
* read global checkNullability flag
* change global checkNullability flag to true
* restore global checkNullability flag to read value
when executed by 2 threads at the same time can *change checkNullability flag to {{true}} for ever*. For this to happen it's enough that
* first thread reads the flag and sets it temporarily to {{true}}
* second thread reads {{true}} (the temporary value)
* first thread completes {{merge}} and restores flag to the original value
* second threads completes {{merge}} and restores flag to the temporary value of {{true}}
was (Author: piofinsy):
Btw. it seems very probable that the sequence the following operations done in {{saveTransientEntity}} ([see source on github|https://github.com/hibernate/hibernate-core/blob/3.6/hibernate-core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java#L409])
* read global checkNullability flag
* change global checkNullability flag to true
* restore global checkNullability flag to read value
when executed by 2 threads at the same time can *change checkNullability flag to {{true}} for ever*. For this to happen it's enough that
* first thread reads the flag and sets it temporarily to {{true}}
* second thread reads {{true}} (the temporary value)
* first thread completes {{merge}} and restores flag to the original value
* second threads completes {{merge}} and restores flag to the temporary value of {{true}}
> DefaultMergeEventListener changes CheckNullability flag - not thread save
> -------------------------------------------------------------------------
>
> Key: HHH-6689
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6689
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.6.5
> Environment: Websphere Application Server 7.0, DB2, Windows Server, Hibernate 3.6.5
> Reporter: John SMith
> Labels: hibernate
>
> saveTransientEntity() method saves the CheckNullability setting, changes it using the getFactory().getSettings().setCheckNullability method, and does save processing. After save processing, the saved value is restored.
> During load testing, we have had situations where the CheckNullability becomes set to TRUE and causes failures because of null checks.
> It has been difficult to debug, but it appears that this is not thread safe - multiple threads accessing this method can change the value of this setting.
> It can also be that a database error can cause an exception that will cause the checkNullability flan not to be reset.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list