zbentley opened a new issue #11902:
URL: https://github.com/apache/pulsar/issues/11902


   **Describe the bug**
   If I POST to the v2 admin api to create a non-persistent topic with the same 
name as a persistent topic that already exists, I would expect to be forbidden 
from doing that with a 4XX response code. Instead I get a 500 response code and 
a stacktrace (at the bottom of this bug).
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Ensure a 2.8.0 broker is running. I've also reproduced this on `master` 
pulled on 9/1/2021 (I don't know what commit ID, sorry).
   2. Create a persistent topic with or without partitions.
   3. Attempt to create a non-persistent topic with the same name as the 
persistent topic created in step 2.
   4. See error, example below.
   
   **Expected behavior**
   A 4XX response code, probably a 409 CONFLICT, and a response body indicating 
that the topic already exists (ideally also indicating that I'm conflicting 
with a topic with different persistence).
   
   
   **Desktop (please complete the following information):**
    - OS: MacOS 10.11
   
   **Additional context**
   This seems like it is probably related to/shares a common cause with 
https://github.com/apache/pulsar/issues/11834
   
   Example stacktrace and HTTP request log:
   ```
   E           chariot.pulsar.client.exceptions.PulsarAPIError: 500 Server 
Error: Internal Server Error for url: 
http://localhost:8080/admin/v2/non-persistent/chariot-test-obj-Tenant-1-lrtX/chariot-test-obj-Namespace-2-Axgd/chariot-test-obj-Topic-3-vGeI/terminate
   E           Response code: 500
   E           URL: POST 
http://localhost:8080/admin/v2/non-persistent/chariot-test-obj-Tenant-1-lrtX/chariot-test-obj-Namespace-2-Axgd/chariot-test-obj-Topic-3-vGeI/terminate
   E           Headers: Headers({'host': 'localhost:8080', 'content-length': 
'0', 'accept': '*/*', 'accept-encoding': 'gzip, deflate', 'connection': 
'keep-alive', 'user-agent': 'python-httpx/0.18.2'})
   E           Payload: b''
   E
   E            --- An unexpected error occurred in the server ---
   E
   E           Message: class 
org.apache.pulsar.broker.service.nonpersistent.NonPersistentTopic cannot be 
cast to class org.apache.pulsar.broker.service.persistent.PersistentTopic 
(org.apache.pulsar.broker.service.nonpersistent.NonPersistentTopic and 
org.apache.pulsar.broker.service.persistent.PersistentTopic are in unnamed 
module of loader 'app')
   E
   E           Stacktrace:
   E
   E           java.lang.ClassCastException: class 
org.apache.pulsar.broker.service.nonpersistent.NonPersistentTopic cannot be 
cast to class org.apache.pulsar.broker.service.persistent.PersistentTopic 
(org.apache.pulsar.broker.service.nonpersistent.NonPersistentTopic and 
org.apache.pulsar.broker.service.persistent.PersistentTopic are in unnamed 
module of loader 'app')
   E            at 
org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.internalTerminate(PersistentTopicsBase.java:3051)
   E            at 
org.apache.pulsar.broker.admin.v2.PersistentTopics.terminate(PersistentTopics.java:2458)
   E            at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   E            at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   E            at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   E            at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   E            at 
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
   E            at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
   E            at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
   E            at 
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219)
   E            at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
   E            at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:475)
   E            at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:397)
   E            at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
   E            at 
org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)
   E            at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
   E            at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
   E            at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
   E            at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
   E            at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
   E            at 
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
   E            at 
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
   E            at 
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
   E            at 
org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
   E            at 
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
   E            at 
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366)
   E            at 
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319)
   E            at 
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
   E            at 
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
   E            at 
org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
   E            at 
org.apache.pulsar.broker.web.ResponseHandlerFilter.doFilter(ResponseHandlerFilter.java:67)
   E            at 
org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
   E            at 
org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
   E            at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
   E            at 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
   E            at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
   E            at 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
   E            at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
   E            at 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
   E            at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
   E            at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
   E            at 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
   E            at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
   E            at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
   E            at 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
   E            at 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
   E            at 
org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:179)
   E            at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
   E            at org.eclipse.jetty.server.Server.handle(Server.java:516)
   E            at 
org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
   E            at 
org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
   E            at 
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
   E            at 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
   E            at 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
   E            at 
org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
   E            at 
org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
   E            at 
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
   E            at 
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
   E            at 
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
   E            at 
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
   E            at 
org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:386)
   E            at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   E            at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   E            at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
   E            at java.base/java.lang.Thread.run(Thread.java:834)
   ```
   


-- 
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