949808802 opened a new issue #12829:
URL: https://github.com/apache/pulsar/issues/12829


   The same code can be run yesterday, but it can't be used today,I don't know 
the cause of the problem and how to solve it!pulsar server and client use 2.8.0
   
   code:
   public static void main(String[] args) throws Exception{
   
           PulsarClient client = PulsarClient
                   .builder()
                   .serviceUrl(Global.clusterUrl)
                   .enableTransaction(true)
                   .build();
           Transaction txn = client
                   .newTransaction()
                   .withTransactionTimeout(1, TimeUnit.MINUTES)
                   .build()
                   .get();
           Producer<byte[]> producer = client.newProducer().sendTimeout(0, 
TimeUnit.MINUTES).topic("transaction-topic-1").create();
           producer.newMessage(txn).value("Hello Pulsar 
Transaction".getBytes()).send();
           Consumer<byte[]> consumer = 
client.newConsumer().topic("transaction-topic-1").subscriptionName("my-sub").subscriptionInitialPosition(SubscriptionInitialPosition.Earliest).subscribe();
           Message<byte[]> message = consumer.receive();
           consumer.acknowledgeCumulativeAsync(message.getMessageId(), txn);
           txn.commit().get();
       }
   
   log:
   [main] WARN 
org.apache.pulsar.shade.io.netty.resolver.dns.DnsServerAddressStreamProviders - 
Can not find 
org.apache.pulsar.shade.io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider
 in the classpath, fallback to system defaults. This may result in incorrect 
DNS resolutions on MacOS.
   [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ConnectionPool - 
[[id: 0x6b59eea5, L:/172.21.34.68:59667 - R:/172.18.100.185:6650]] Connected to 
server
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 0 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 3 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 4 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 7 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 8 connection opened.
   [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ConnectionPool - 
[[id: 0x37bd1a04, L:/172.21.34.68:59668 - R:/172.18.100.187:6650]] Connected to 
server
   [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ConnectionPool - 
[[id: 0x8113c394, L:/172.21.34.68:59669 - R:/172.18.100.186:6650]] Connected to 
server
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 15 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 13 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 11 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 9 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 5 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 1 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 14 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 12 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 10 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 6 connection opened.
   [pulsar-client-io-1-1] INFO 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Transaction meta 
handler with transaction coordinator id 2 connection opened.
   [pulsar-client-io-1-1] ERROR 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler - Got new txn for 
request 17 error UnknownError
   [pulsar-client-io-1-1] ERROR 
org.apache.pulsar.client.impl.transaction.TransactionBuilderImpl - New 
transaction error.
   
org.apache.pulsar.client.api.transaction.TransactionCoordinatorClientException: 
org.apache.bookkeeper.mledger.ManagedLedgerException$ManagedLedgerFencedException:
 java.lang.Exception: Attempted to use a fenced managed ledger
        at 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler.getExceptionByServerError(TransactionMetaStoreHandler.java:374)
        at 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler.handleNewTxnResponse(TransactionMetaStoreHandler.java:161)
        at 
org.apache.pulsar.client.impl.ClientCnx.handleNewTxnResponse(ClientCnx.java:924)
        at 
org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:371)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at 
org.apache.pulsar.shade.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
        at 
org.apache.pulsar.shade.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at 
org.apache.pulsar.shade.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at 
org.apache.pulsar.shade.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at 
org.apache.pulsar.shade.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at 
org.apache.pulsar.shade.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at 
org.apache.pulsar.shade.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
   Exception in thread "main" java.util.concurrent.ExecutionException: 
org.apache.pulsar.client.api.transaction.TransactionCoordinatorClientException: 
org.apache.bookkeeper.mledger.ManagedLedgerException$ManagedLedgerFencedException:
 java.lang.Exception: Attempted to use a fenced managed ledger
        at 
java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
        at 
java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
        at 
com.kingdee.pulsar.demo.exclusive.transactions.test.main(test.java:27)
   Caused by: 
org.apache.pulsar.client.api.transaction.TransactionCoordinatorClientException: 
org.apache.bookkeeper.mledger.ManagedLedgerException$ManagedLedgerFencedException:
 java.lang.Exception: Attempted to use a fenced managed ledger
        at 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler.getExceptionByServerError(TransactionMetaStoreHandler.java:374)
        at 
org.apache.pulsar.client.impl.TransactionMetaStoreHandler.handleNewTxnResponse(TransactionMetaStoreHandler.java:161)
        at 
org.apache.pulsar.client.impl.ClientCnx.handleNewTxnResponse(ClientCnx.java:924)
        at 
org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:371)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at 
org.apache.pulsar.shade.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
        at 
org.apache.pulsar.shade.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at 
org.apache.pulsar.shade.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at 
org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at 
org.apache.pulsar.shade.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
        at 
org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at 
org.apache.pulsar.shade.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at 
org.apache.pulsar.shade.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at 
org.apache.pulsar.shade.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to