eclipselink icon indicating copy to clipboard operation
eclipselink copied to clipboard

Bug in internal.helper.ConcurrencyUtil.dumpConcurrencyManagerInformationStep02(ConcurrencyManagerState) - copy paste mistake - it logs twice the Page 03 start - information about threads waiting to acquire read cache keys

Open 99sono opened this issue 1 year ago • 0 comments

Describe the bug There is a bug in org.eclipse.persistence.internal.helper.ConcurrencyUtil.dumpConcurrencyManagerInformationStep02(ConcurrencyManagerState)

https://github.com/eclipse-ee4j/eclipselink/blob/2.7.9/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/helper/ConcurrencyUtil.java

This method has copy mistake, see here:

  // (b) log information about the threads that are waiting to acquire WRITE/DEFERRED locks
        // PAGE 02 of logging information
        writer.write(createInformationAboutAllThreadsWaitingToAcquireReadCacheKeys(concurrencyManagerState.getMapThreadToWaitOnAcquireReadLockClone(),
                concurrencyManagerState.getMapThreadToWaitOnAcquireReadLockCloneMethodName()));
        // (c) log information about the threads that are waiting to acquire READ locks
        // PAGE 03 of logging information
        writer.write(createInformationAboutAllThreadsWaitingToAcquireReadCacheKeys(concurrencyManagerState.getMapThreadToWaitOnAcquireReadLockClone(),
                concurrencyManagerState.getMapThreadToWaitOnAcquireReadLockCloneMethodName()));

If I look at the code of the original manipulated eclipselink, the code there was written like this:

org.eclipse.persistence.internal.helper.HackingEclipseHelperUtil.dumpConcurrencyManagerInformationStep02(HackingEclipseDtoExplainingConcurrencyManagerStateDto)

// (b) log information about the threads that are waiting to acquire WRITE/DEFERRED locks // PAGE 02 of logging information massiveMessageSb.append(createInformationAboutAllThreadsWaitingToAcquireCacheKeys( concurrencyManagerStateDto.getUnifiedMapOfThreadsStuckTryingToAcquireWriteLock(), concurrencyManagerStateDto.getUnifiedMapOfThreadsStuckTryingToAcquireWriteLockMethodName()));

    // (c) log information about the threads that are waiting to acquire READ locks
    // PAGE 03 of logging information
    massiveMessageSb.append(
            createInformationAboutAllThreadsWaitingToAcquireReadCacheKeys(
                    concurrencyManagerStateDto.getMapThreadToWaitOnAcquireReadLockClone(),
                    concurrencyManagerStateDto.getMapThreadToWaitOnAcquireReadLockCloneMethodName()));

As a result, when eclipselink believes to go into a dead lock and generates the massive dump, we end up with logging of this form:

Concurrency manager - Page 03 start - information about threads waiting to acquire read cache keys 
Total number of threads waiting to acquire read locks: 0 

Concurrency manager - Page 03 end - information about threads waiting to acquire read cache keys
Concurrency manager - Page 03 start - information about threads waiting to acquire read cache keys 
Total number of threads waiting to acquire read locks: 0 

Concurrency manager - Page 03 end - information about threads waiting to acquire read cache keys

In the manipulated eclipselink library the logging should look like this:

**```


CONCURRENCY MANAGER - START PAGE 02 - INFORMATION ABOUT THREADS WAITING TO ACQUIRE (WRITE/DEFERRED) CACHE KEYS


Total number of threads waiting to acquire lock: 0


CONCURRENCY MANAGER - END PAGE 02 - INFORMATION ABOUT THREADS WAITING TO ACQUIRE (WRITE/DEFERRED) CACHE KEYS



CONCURRENCY MANAGER - START PAGE 02 - INFORMATION ABOUT THREADS WAITING TO ACQUIRE (WRITE/DEFERRED) CACHE KEYS


Total number of threads waiting to acquire lock: 0


CONCURRENCY MANAGER - END PAGE 02 - INFORMATION ABOUT THREADS WAITING TO ACQUIRE (WRITE/DEFERRED) CACHE KEYS



CONCURRENCY MANAGER - START PAGE 03 - INFORMATION ABOUT THREADS WAITING TO ACQUIRE READ CACHE KEYS


Total number of threads waiting to acquire read locks: 1

[currentThreadNumber: 1] [ThreadName: [ACTIVE] ExecuteThread: '218' for queue: 'weblogic.kernel.Default (self-tuning)' ]: Waiting to acquire (read lock): --- CacheKey .... blalblalbla


CONCURRENCY MANAGER - END PAGE 03 - INFORMATION ABOUT THREADS WAITING TO ACQUIRE READ CACHE KEYS


[HackingEclipseHelperUtil.txt](https://github.com/eclipse-ee4j/eclipselink/files/14584272/HackingEclipseHelperUtil.txt)


Thanks for having a look.
Having the report with all the information is important. 

99sono avatar Mar 13 '24 07:03 99sono