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

Deleting a Pulsar Function with a name that includes a colon character crashes the pulsar broker #9946

Closed
csthomas1 opened this issue Mar 17, 2021 · 0 comments · Fixed by #9979
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@csthomas1
Copy link
Contributor

csthomas1 commented Mar 17, 2021

Describe the bug
I'm able to successfully deploy in Pulsar a Pulsar function that includes a ':' as part of its function name. When I later try to delete the function deployment, the Pulsar broker ends up crashing with an IllegalArgumentException in its log stating "Invalid format for fully qualified instance name: :". If the KubernetesRuntime is configured, this prevents deletion of the function's statefulset.

The bug can be found in the class org.apache.pulsar.function.utils.FunctionInstanceId within the pulsar-function-utils library -- it relies on a ':' as a delimiter to separate the function name from the instance id, and in so doing assumes that there can only be at most one ':' in the function name.

This has been observed on both Pulsar 2.6.0 and Pulsar 2.7.0.

To Reproduce
Steps to reproduce the behavior:

  1. Use pulsar-admin to deploy a function. Specify a function name that includes a ':'. Example:
pa functions create --fqfn platform/passthrough2/test:input:filter -i persistent://public/default/input -o persistent://public/default/output --jar /tmp/test-functions-1.0.0-SNAPSHOT.jar --classname messaging.pulsar.functions.PassThroughFilter
  1. Wait until the function is running, then try to delete the function. Example:
pa functions delete --fqfn platform/passthrough2/test:input:filter
  1. Check the status of whichever broker received the request to remove the function instance. You should see evidence of a crash. In the logs you'll see the following message:
java.lang.IllegalArgumentException: Invalid format for fully qualified instance name: platform/passthrough2/test:input:filter

Expected behavior

Since pulsar accepts a function name that includes ':' during creation, it should support it during deletion as well.

Additional context
Pull request incoming...

@csthomas1 csthomas1 added the type/bug The PR fixed a bug or issue reported a bug label Mar 17, 2021
codelipenghui pushed a commit that referenced this issue Mar 24, 2021
Fixes #9946

### Motivation

I'm able to successfully deploy in Pulsar a Pulsar function that includes a ':' as part of its function name. When I later try to delete the function deployment, the Pulsar broker ends up crashing with an IllegalArgumentException in its log stating "Invalid format for fully qualified instance name: :". If the KubernetesRuntime is configured, this prevents deletion of the function's statefulset.

Since pulsar accepts a function name that includes ':' during creation, it should support it during deletion as well.

### Modifications

- Changed org.apache.pulsar.functions.utils.FunctionInstanceId constructor to split on the last colon in the function name, so that it both retrieves the instanceId and tolerates the presence of colons in the function name
- Added unit test org.apache.pulsar.functions.utils.FunctionInstanceIdTest to validate parsing
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
1 participant