Bob Barrett created KAFKA-9811: ---------------------------------- Summary: TransactionMetadata state and pendingState are non-volatile and read outside the metadata lock Key: KAFKA-9811 URL: https://issues.apache.org/jira/browse/KAFKA-9811 Project: Kafka Issue Type: Bug Reporter: Bob Barrett
As an example, in TransactionStateManager.timedOutTransactions(), we read the state and pendingState without acquiring the lock for each metadata object: {code:java} inReadLock(stateLock) { transactionMetadataCache.flatMap { case (_, entry) => entry.metadataPerTransactionalId.filter { case (_, txnMetadata) => if (txnMetadata.pendingTransitionInProgress) { false } else { txnMetadata.state match { case Ongoing => txnMetadata.txnStartTimestamp + txnMetadata.txnTimeoutMs < now case _ => false } } }.map { case (txnId, txnMetadata) => TransactionalIdAndProducerIdEpoch(txnId, txnMetadata.producerId, txnMetadata.producerEpoch) } } }{code} The start timestamp is volatile, so it can be safely read, but we also read the pendingState and state, which are not. -- This message was sent by Atlassian Jira (v8.3.4#803005)