-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New eclipselink dead lock scenario ... enhancement and unit test (#2350)
Fixes #2094 This is enhancement for case of possible deadlock which should happens in org.eclipse.persistence.internal.sessions.AbstractSession#getCacheKeyFromTargetSessionForMerge method if used org.eclipse.persistence.internal.identitymaps.CacheKey instance is locked by another thread. There is new system or persistence property eclipselink.concurrency.manager.allow.getcachekeyformerge.mode which can control org.eclipse.persistence.internal.sessions.AbstractSession#getCacheKeyFromTargetSessionForMerge logic to get org.eclipse.persistence.internal.identitymaps.CacheKey instance and object value behind this. There are two allowed values: ORIGIN (DEFAULT) - There is infinite java.lang.Object.wait() call in case of some conditions during time when object/entity referred from org.eclipse.persistence.internal.identitymaps.CacheKey is locked and modified by another thread. In some cases it should leads into deadlock. WAITLOOP - Merge manager will try in the loop with timeout wait cacheKey.wait(ConcurrencyUtil.SINGLETON.getAcquireWaitTime()); fetch object/entity from org.eclipse.persistence.internal.identitymaps.CacheKey. If fetch will be successful object/entity loop finish and continue with remaining code. If not java.lang.InterruptedException is thrown and caught and used org.eclipse.persistence.internal.identitymaps.CacheKey instance status is set into invalidation state. This strategy avoid deadlock issue, but there should be impact to the performance. Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
- Loading branch information
Showing
14 changed files
with
579 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...sistence.core/src/main/java/org/eclipse/persistence/config/MergeManagerOperationMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Oracle - initial API and implementation | ||
package org.eclipse.persistence.config; | ||
|
||
/** | ||
* INTERNAL: | ||
* <p> | ||
* <b>Purpose</b>: It is data model behind {@linkplain org.eclipse.persistence.config.SystemProperties#CONCURRENCY_MANAGER_ALLOW_GET_CACHE_KEY_FOR_MERGE_MODE} | ||
* or {@linkplain org.eclipse.persistence.config.PersistenceUnitProperties#CONCURRENCY_MANAGER_ALLOW_GET_CACHE_KEY_FOR_MERGE_MODE}. | ||
*/ | ||
public final class MergeManagerOperationMode { | ||
|
||
/** | ||
* {@code ORIGIN} (DEFAULT) - There is infinite {@linkplain java.lang.Object#wait()} call in case of some conditions during time when object/entity referred from | ||
* {@code org.eclipse.persistence.internal.identitymaps.CacheKey} is locked and modified by another thread. In some cases it should leads into deadlock. | ||
*/ | ||
public static final String ORIGIN = "ORIGIN"; | ||
|
||
/** | ||
* {@code WAITLOOP} - Merge manager will try in the loop with timeout wait {@code cacheKey.wait(ConcurrencyUtil.SINGLETON.getAcquireWaitTime());} | ||
* fetch object/entity from {@linkplain org.eclipse.persistence.internal.identitymaps.CacheKey}. If fetch will be successful object/entity loop finish and continue | ||
* with remaining code. If not @{code java.lang.InterruptedException} is thrown and caught and used {@linkplain org.eclipse.persistence.internal.identitymaps.CacheKey} instance | ||
* status is set into invalidation state. This strategy avoid deadlock issue, but there should be impact to the performance. | ||
*/ | ||
public static final String WAITLOOP = "WAITLOOP"; | ||
|
||
private MergeManagerOperationMode() { | ||
// no instance please | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.