Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

healthcheck report error: Trying to subscribe with incompatible schema #4790

Closed
HeChuanXUPT opened this issue Jul 24, 2019 · 0 comments · Fixed by #5563
Closed

healthcheck report error: Trying to subscribe with incompatible schema #4790

HeChuanXUPT opened this issue Jul 24, 2019 · 0 comments · Fixed by #5563
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@HeChuanXUPT
Copy link

Describe the bug
healthcheck api report error

To Reproduce
Steps to reproduce the behavior:

  1. access http://127.0.0.1:8080/admin/v2/brokers/health
  2. see errors
 --- An unexpected error occurred in the server ---

Message: org.apache.pulsar.client.api.PulsarClientException$IncompatibleSchemaException: Trying to subscribe with incompatible schema

Stacktrace:

java.util.concurrent.CompletionException: org.apache.pulsar.client.api.PulsarClientException$IncompatibleSchemaException: Trying to subscribe with incompatible schema
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
	at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:700)
	at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:687)
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
	at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
	at org.apache.pulsar.client.impl.ClientCnx.handleError(ClientCnx.java:597)
	at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:154)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:297)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:799)
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:433)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:330)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.pulsar.client.api.PulsarClientException$IncompatibleSchemaException: Trying to subscribe with incompatible schema
	at org.apache.pulsar.client.impl.ClientCnx.getPulsarClientException(ClientCnx.java:905)
	... 20 more

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS: [Linux]

Additional context
version: apache-pulsar-2.4.0
access other broker/cluster api not encounter errors, like get http://127.0.0.1:8080/admin/v2/clusters successfully
use bin/pulsar-client to produce or consume data is ok

@HeChuanXUPT HeChuanXUPT added the type/bug The PR fixed a bug or issue reported a bug label Jul 24, 2019
sijie pushed a commit that referenced this issue Nov 6, 2019
Fixes #4790


Master Issue: #4790

### Motivation
Currently, when the brokerDeleteInactiveTopicsEnabled policy is enabled, the topic pulsar/standalone/127.0.0.1:8080/healthcheck will be deleted periodically, when creating producer and consumer for the second time https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java#L272, because both producer and consumer call putSchema in a short period of time, resulting in race conditions, Throwing exceptions of schema badVersion, only one of them could succeed. therefore, when badVersion exception occurs, call putSchema should be performed again. 
### Modifications

* Add operation to handle exception KeeperException.BadVersionException

### Verifying this change

```
./bin/pulsar standalone -nss -a 127.0.0.1
curl -v http://127.0.0.1:8080/admin/v2/brokers/health

# Waiting for more than 60 seconds, waiting for the topic pulsar/standalone/127.0.0.1:8080/healthcheck to be deleted

curl -v http://127.0.0.1:8080/admin/v2/brokers/health
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants