same pulsar-admin should seamlessly work with both brokers and function workers in a distributed environment
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 142
Description
I am running Function worker as a separate machine, and pulsar-admin gives this error:
```
# bin/pulsar-admin functions create --py c.py --classname router.RoutingFunction --tenant c1-d1 --namespace emsaas --name test1 --inputs persistent://c1-d1/emsaas/in
Function worker service is not done initializing. Please try again in a little while.
Reason: HTTP 503 Service Unavailable
```
client.conf points to the broker. Changing webServiceUrl to point to the function worker fixes the issue. This is not intuitive and the error message doesn't help. I would expect pulsar-admin to get the Function worker address from the broker somehow and work transparently without the need to use different client.conf's.
Relevant broker log:
172.32.2.235 is the address of the Function worker, and the log that fails it seems to connect to 127.0.0.1.
```
Feb 23 13:17:09 localhost pulsar: 13:17:09.892 [pulsar-web-30-15] INFO org.eclipse.jetty.server.RequestLog - 172.32.2.235 - - [23/Feb/2020:13:17:09 +0000] "GET /admin/v2/persistent/public/functions/coordinate/stats HTTP/1.1" 200 901 "-" "Pulsar-Java-v2.5.0" 1
Feb 23 13:17:39 localhost pulsar: 13:17:39.879 [pulsar-web-30-8] INFO org.eclipse.jetty.server.RequestLog - 172.32.2.235 - - [23/Feb/2020:13:17:39 +0000] "GET /admin/v2/persistent/public/functions/coordinate/stats HTTP/1.1" 200 901 "-" "Pulsar-Java-v2.5.0" 3
Feb 23 13:17:41 localhost pulsar: 13:17:41.644 [pulsar-web-30-4] INFO org.eclipse.jetty.server.RequestLog - 127.0.0.1 - - [23/Feb/2020:13:17:41 +0000] "POST /admin/v3/functions/c1-d1/emsaas/test1 HTTP/1.1" 503 98 "-" "Pulsar-Java-v2.5.0" 4
Feb 23 13:17:54 localhost kernel: ena: Feature 27 isn't supported
Feb 23 13:18:09 localhost pulsar: 13:18:09.879 [pulsar-web-30-6] INFO org.eclipse.jetty.server.RequestLog - 172.32.2.235 - - [23/Feb/2020:13:18:09 +0000] "GET /admin/v2/persistent/public/functions/coordinate/stats HTTP/1.1" 200 901 "-" "Pulsar-Java-v2.5.0" 1
```
Contributor guide
Research direction
Start with the pulsar-admin functions create path and the broker/function-worker webServiceUrl handling described in the report. Trace the coordination endpoint and the HTTP 503 path shown in the logs. Done means a broker-targeted client.conf supports function-worker operations transparently, with an actionable error when discovery or initialization fails.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, distributed-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100