GitHub user apurvam opened a pull request:

    https://github.com/apache/kafka/pull/3343

    WIP: KAFKA-5449: fix bad state transition in transaction manager

    The 
`kafka.api.TransactionsTest.testReadCommittedConsumerShouldNotSeeUndecidedData` 
very rarely sees the following. 
    
    I have run it 700 times locally without failure, so it only happens on 
jenkins.
    
    this PR adds trace logging to the client. Will keep running the PR builder 
here and hope that the test fails again so that we can understand what's going 
on.
    
    It is strange that we we have an ongoing send when we are in `READY` state. 
It is even more strange that we see a `ProducerFencedException` in the log. 
Could it be that some other run is interfering with this one (since multiple 
test cases use the same producer ids) ?
    
    ```
    [2017-06-13 23:58:09,644] ERROR Aborting producer batches due to fatal 
error (org.apache.kafka.clients.producer.internals.Sender:381)
    org.apache.kafka.common.errors.ProducerFencedException: Producer attempted 
an operation with an old epoch. Either there is a newer producer with the same 
transactionalId, or the producer's transaction has been expired by the broker.
    [2017-06-13 23:58:10,177] ERROR [ReplicaFetcherThread-0-0]: Error for 
partition [topic2,3] to broker 
0:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is 
not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:10,177] ERROR [ReplicaFetcherThread-0-0]: Error for 
partition [topic2,0] to broker 
0:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is 
not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:10,178] ERROR [ReplicaFetcherThread-0-0]: Error for 
partition [topic1,2] to broker 
0:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is 
not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:12,128] ERROR ZKShutdownHandler is not registered, so 
ZooKeeper server won't take any action on ERROR or SHUTDOWN server state 
changes (org.apache.zookeeper.server.ZooKeeperServer:472)
    [2017-06-13 23:58:12,134] ERROR ZKShutdownHandler is not registered, so 
ZooKeeper server won't take any action on ERROR or SHUTDOWN server state 
changes (org.apache.zookeeper.server.ZooKeeperServer:472)
    [2017-06-13 23:58:12,310] ERROR [ReplicaFetcherThread-0-1]: Error for 
partition [topic1,0] to broker 
1:org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server 
does not host this topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:12,311] ERROR [ReplicaFetcherThread-0-1]: Error for 
partition [topic1,3] to broker 
1:org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server 
does not host this topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:15,998] ERROR ZKShutdownHandler is not registered, so 
ZooKeeper server won't take any action on ERROR or SHUTDOWN server state 
changes (org.apache.zookeeper.server.ZooKeeperServer:472)
    [2017-06-13 23:58:16,005] ERROR ZKShutdownHandler is not registered, so 
ZooKeeper server won't take any action on ERROR or SHUTDOWN server state 
changes (org.apache.zookeeper.server.ZooKeeperServer:472)
    [2017-06-13 23:58:16,177] ERROR [ReplicaFetcherThread-0-2]: Error for 
partition [topic1,2] to broker 
2:org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server 
does not host this topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:16,177] ERROR [ReplicaFetcherThread-0-0]: Error for 
partition [topic1,3] to broker 
0:org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server 
does not host this topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:16,178] ERROR [ReplicaFetcherThread-0-0]: Error for 
partition [topic1,0] to broker 
0:org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server 
does not host this topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:28,177] ERROR Uncaught error in kafka producer I/O 
thread:  (org.apache.kafka.clients.producer.internals.Sender:164)
    org.apache.kafka.common.KafkaException: Invalid transition attempted from 
state READY to state ABORTABLE_ERROR
        at 
org.apache.kafka.clients.producer.internals.TransactionManager.transitionTo(TransactionManager.java:476)
        at 
org.apache.kafka.clients.producer.internals.TransactionManager.transitionToAbortableError(TransactionManager.java:289)
        at 
org.apache.kafka.clients.producer.internals.Sender.failBatch(Sender.java:601)
        at 
org.apache.kafka.clients.producer.internals.Sender.sendProducerData(Sender.java:272)
        at 
org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:223)
        at 
org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:162)
        at java.lang.Thread.run(Thread.java:745)
    [2017-06-13 23:58:33,243] ERROR [ReplicaFetcherThread-0-0]: Error for 
partition [topic2,3] to broker 
0:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is 
not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:33,245] ERROR [ReplicaFetcherThread-0-0]: Error for 
partition [topic2,0] to broker 
0:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is 
not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread:99)
    [2017-06-13 23:58:35,665] WARN caught end of stream exception 
(org.apache.zookeeper.server.NIOServerCnxn:368)
    EndOfStreamException: Unable to read additional data from client sessionid 
0x15ca3e4bdc30001, likely client has closed socket
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apurvam/kafka 
KAFKA-5449-fix-bad-state-transition-in-transaction-manager

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/3343.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3343
    
----
commit 8ff0494e586092ff441bd0e4ca608e23f8c3f511
Author: Apurva Mehta <apu...@confluent.io>
Date:   2017-06-14T19:59:47Z

    Add trace logging for transaction manager

commit 2d4782252e33bddeed19fa731d3b886c08821476
Author: Apurva Mehta <apu...@confluent.io>
Date:   2017-06-14T21:18:57Z

    Add log prefix to some log messages in the sender

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to