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

Cannot create producer via websocket in standalone mode #6079

Closed
VitalyShein opened this issue Jan 17, 2020 · 4 comments · Fixed by #6102
Closed

Cannot create producer via websocket in standalone mode #6079

VitalyShein opened this issue Jan 17, 2020 · 4 comments · Fixed by #6102
Assignees
Labels
area/websocket type/bug The PR fixed a bug or issue reported a bug

Comments

@VitalyShein
Copy link

VitalyShein commented Jan 17, 2020

Describe the bug
Websocket api is broken - it is impossible to connect with producer to any existing topic.

To Reproduce
Steps to reproduce the behavior:

  1. Run pulsar in standalone mode (docker-compose file):
services:
  standalone:
    image: apachepulsar/pulsar-standalone:2.5.0
    expose:
      - 8080
      - 6650
    ports:
      - "6650:6650"
      - "8080:8080"
  1. Try to create producer via websocket (python 3.7)
import asyncio
import websockets

async def connect_test():
    TOPIC = 'ws://localhost:8080/ws/v2/producer/persistent/public/default/my-topic'
    async with websockets.connect(TOPIC) as websocket:
        print('connected!')

asyncio.get_event_loop().run_until_complete(connect_test())
  1. An exception will occur: error 400
  2. Pulsar logs in docker:
12:46:38.002 [pulsar-web-57-6] WARN  org.apache.pulsar.websocket.ProducerHandler - [172.18.0.1:48562] Failed in creating producer on topic persistent://public/default/my-topic: Param serviceUrl must not be blank.
12:46:38.002 [pulsar-web-57-6] INFO  org.eclipse.jetty.server.RequestLog - 172.18.0.1 - - [17/Jan/2020:12:46:38 +0000] "GET /ws/v2/producer/persistent/public/default/my-topic HTTP/1.1" 400 462 "-" "Python/3.7 websockets/8.1" 1
  1. Change version of pulsar to 2.4.2 - all is working fine!

Desktop (please complete the following information):

  • OS: Windows 10
  • Docker-engine: 19.0.3.5
@VitalyShein
Copy link
Author

VitalyShein commented Jan 17, 2020

I think this is the same issue: #5997

@sijie sijie self-assigned this Jan 21, 2020
@sijie
Copy link
Member

sijie commented Jan 21, 2020

It seems to be a regression from #5486. I am working on a fix.

sijie added a commit that referenced this issue Jan 24, 2020
*Motivation*

Fixes #5997
Fixes #6079

A regression was introduced in #5486. If websocket service as running as part of
pulsar standalone, the cluster data is set with null service urls. This causes
service url is not set correctly in the pulsar client and an illegal argument exception
("Param serviceUrl must not be blank.") will be thrown.

*Modifications*

1. Pass `null` when constructing the websocket service. So the local cluster data can
   be refreshed when creating pulsar client.
2. Set the cluster data after both broker service and web service started and ports are allocated.
tuteng pushed a commit to AmateurEvents/pulsar that referenced this issue Feb 23, 2020
)

*Motivation*

Fixes apache#5997
Fixes apache#6079

A regression was introduced in apache#5486. If websocket service as running as part of
pulsar standalone, the cluster data is set with null service urls. This causes
service url is not set correctly in the pulsar client and an illegal argument exception
("Param serviceUrl must not be blank.") will be thrown.

*Modifications*

1. Pass `null` when constructing the websocket service. So the local cluster data can
   be refreshed when creating pulsar client.
2. Set the cluster data after both broker service and web service started and ports are allocated.
tuteng pushed a commit to AmateurEvents/pulsar that referenced this issue Mar 21, 2020
)

*Motivation*

Fixes apache#5997
Fixes apache#6079

A regression was introduced in apache#5486. If websocket service as running as part of
pulsar standalone, the cluster data is set with null service urls. This causes
service url is not set correctly in the pulsar client and an illegal argument exception
("Param serviceUrl must not be blank.") will be thrown.

*Modifications*

1. Pass `null` when constructing the websocket service. So the local cluster data can
   be refreshed when creating pulsar client.
2. Set the cluster data after both broker service and web service started and ports are allocated.

(cherry picked from commit 49a9897)
@ckreiling
Copy link

Any updates on this? I have ran into the same issue and am glad to see the discussion is already in progress. Thanks!

@ckreiling
Copy link

Nevermind, I found the apache-pulsar/pulsar:latest image works 👍

tuteng pushed a commit that referenced this issue Apr 13, 2020
*Motivation*

Fixes #5997
Fixes #6079

A regression was introduced in #5486. If websocket service as running as part of
pulsar standalone, the cluster data is set with null service urls. This causes
service url is not set correctly in the pulsar client and an illegal argument exception
("Param serviceUrl must not be blank.") will be thrown.

*Modifications*

1. Pass `null` when constructing the websocket service. So the local cluster data can
   be refreshed when creating pulsar client.
2. Set the cluster data after both broker service and web service started and ports are allocated.

(cherry picked from commit 49a9897)
jiazhai pushed a commit to jiazhai/pulsar that referenced this issue May 18, 2020
)

*Motivation*

Fixes apache#5997
Fixes apache#6079

A regression was introduced in apache#5486. If websocket service as running as part of
pulsar standalone, the cluster data is set with null service urls. This causes
service url is not set correctly in the pulsar client and an illegal argument exception
("Param serviceUrl must not be blank.") will be thrown.

*Modifications*

1. Pass `null` when constructing the websocket service. So the local cluster data can
   be refreshed when creating pulsar client.
2. Set the cluster data after both broker service and web service started and ports are allocated.
(cherry picked from commit 49a9897)
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this issue Aug 24, 2020
)

*Motivation*

Fixes apache#5997
Fixes apache#6079

A regression was introduced in apache#5486. If websocket service as running as part of
pulsar standalone, the cluster data is set with null service urls. This causes
service url is not set correctly in the pulsar client and an illegal argument exception
("Param serviceUrl must not be blank.") will be thrown.

*Modifications*

1. Pass `null` when constructing the websocket service. So the local cluster data can
   be refreshed when creating pulsar client.
2. Set the cluster data after both broker service and web service started and ports are allocated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/websocket 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.

3 participants