Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
WalSegmentSyncer#shutdown uses U.join(GridWorker, IgniteLogger) method which delegates to GridWorker#join()
GridWorker.java
public void join() throws InterruptedException { ... if ((runner == null && isCancelled) || finished) return; synchronized (mux) { while (!finished) mux.wait(); } }
On the other hand, GridWorker#run() nullifies the runner field after the worker notifies all threads that work is finished:
GridWorker.java
@Override public final void run() { // Runner thread must be recorded first as other operations // may depend on it being present. runner = Thread.currentThread(); try { ... body(); } catch (Throwable e) { ... } finally { synchronized (mux) { finished = true; mux.notifyAll(); } ... // Need to set runner to null, to make sure that // further operations on this runnable won't // affect the thread which could have been recycled // by thread pool. runner = null; } }
This can lead to AssertionError like the following:
java.lang.AssertionError: WalSegmentSyncer is running. org.apache.ignite.internal.processors.cache.persistence.wal.filehandle.FileHandleManagerImpl$WalSegmentSyncer.restart(FileHandleManagerImpl.java:646) org.apache.ignite.internal.processors.cache.persistence.wal.filehandle.FileHandleManagerImpl.resumeLogging(FileHandleManagerImpl.java:235) org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager.resumeLogging(FileWriteAheadLogManager.java:705) org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.resumeWalLogging(GridCacheDatabaseSharedManager.java:1707) org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.finishRecovery(GridCacheDatabaseSharedManager.java:757) org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.onActivate(GridCacheDatabaseSharedManager.java:637) org.apache.ignite.internal.processors.cache.GridCacheSharedContext.activate(GridCacheSharedContext.java:296) org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPartitionsExchangeFuture.java:1322) org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:964) org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:3375) org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:3194) org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:119) java.lang.Thread.run(Thread.java:748)
Attachments
Issue Links
- links to