You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[issue] In effectively_once mode, when a single pod fails, the entire function will fail due to failure to create the producer. #711
When I enable effectively_once and deploy the function in k8s, for example, after deploying 5 pods, when one of my pods crashes, his subscription will be transferred to other pods due to failover mode. At this time, other pods will fail to create the producer because the producer on the server side is not closed.
Failedtocreateproducer: {"errorMsg":"org.apache.pulsar.broker.service.BrokerServiceException$NamingException: Producer with name 'persistent://pulsar/default/input_test-partition-5-0' is already connected to topic","reqId":1766584259806202457, "remote":"21.21.47.12/21.21.47.12:6650", "local":"/9.165.174.197:46786"}
After this, the function restarts due to an exception, and due to failover, the function once again transfers the subscription and fails due to failure to create the producer. Causes the all function pods to constantly restart
Therefore, when I need to enable effectively_once, I have to deploy multiple functions to consume partitioned topics separately. But this is not an easy way to maintain
In addition, the function can easily fall into the following error and be stuck because of this error until the broker is restarted.
it looks like that the server should close the producer when the related client is crashed and doesn't close the producer
which version of Pulsar are you using? @graysonzeng
Thanks for your reply, the pulsar version is 3.1.1。I agree with you. It seems that some mechanism is needed to properly shut down the producer before creating it.
I can't reproduce the error, when I manually delete one function pod, its producer for output topic will be closed by the server too, so the next active consumer can create the producer
I can't reproduce the error, when I manually delete one function pod, its producer for output topic will be closed by the server too, so the next active consumer can create the producer
when pod-1 crashes, another pod(like pod-2) will take over pod-1's subscription to pod-1 subscripted partition(like partition-5), if a message comes to partition-5, the pod-2 will create a new producer with the name persistent://pulsar/default/input_test-partition-5-0, then when pod-1 restarted and got a new message, it cannot create new producer with name persistent://pulsar/default/input_test-partition-5-0
this issue is caused by JavaInstanceRunnable, I will fix it in the apache/pulsar repo
when pod-1 crashes, another pod(like pod-2) will take over pod-1's subscription to pod-1 subscripted partition(like partition-5), if a message comes to partition-5, the pod-2 will create a new producer with the name persistent://pulsar/default/input_test-partition-5-0, then when pod-1 restarted and got a new message, it cannot create new producer with name persistent://pulsar/default/input_test-partition-5-0
this issue is caused by JavaInstanceRunnable, I will fix it in the apache/pulsar repo
I created a pr here: apache/pulsar#21912, and built a jar based on it, could you add it to your runner image to check whether the issue is resolved? @graysonzeng
Thanks for the suggestion. I have an idea, how about using independent subscription names for each pod. For example, I have 10 partitions on the consumer side and two pods for consumption. Then, my two pods set subscription names A and B respectively. After this, even if the pod fails, the subscription will not be switched to other surviving pods due to failover, and it can continue to consume when the pod is pulled up by kubernetes. @jiangpengcheng
A and B consume part of the partitions respectively. For example, A consumes partitions 0-4 and B consumes partitions 5-9. This will not lead to duplication.
A and B consume part of the partitions respectively.
this needs to be specified manually, which is just like what you do now:
Therefore, when I need to enable effectively_once, I have to deploy multiple functions to consume partitioned topics separately. But this is not an easy way to maintain
Thanks . I originally thought that the creation of subscription does not need to be specified manually. In this way, the user can create a sink with mutil-replicas. No need to configure multiple configurations in yaml repeatedly. But it seems like this is the only way it can be for now @jiangpengcheng
Activity
graysonzeng commentedon Dec 25, 2023
@freeznet
@nlu90
@jiangpengcheng
PTAL
jiangpengcheng commentedon Jan 3, 2024
it looks like that the server should close the producer when the related client is crashed and doesn't close the producer
which version of Pulsar are you using? @graysonzeng
graysonzeng commentedon Jan 4, 2024
Thanks for your reply, the pulsar version is 3.1.1。I agree with you. It seems that some mechanism is needed to properly shut down the producer before creating it.
jiangpengcheng commentedon Jan 9, 2024
I will check it
jiangpengcheng commentedon Jan 12, 2024
I can't reproduce the error, when I manually delete one function pod, its producer for output topic will be closed by the server too, so the next active consumer can create the producer
could u share the yaml you used? @graysonzeng
graysonzeng commentedon Jan 12, 2024
Of course @jiangpengcheng
jiangpengcheng commentedon Jan 16, 2024
I see, the error is caused by below:
when pod-1 crashes, another pod(like pod-2) will take over pod-1's subscription to pod-1 subscripted partition(like partition-5), if a message comes to partition-5, the pod-2 will create a new producer with the name
persistent://pulsar/default/input_test-partition-5-0, then when pod-1 restarted and got a new message, it cannot create new producer with namepersistent://pulsar/default/input_test-partition-5-0this issue is caused by
JavaInstanceRunnable, I will fix it in theapache/pulsarrepo@graysonzeng
graysonzeng commentedon Jan 17, 2024
thanks!
jiangpengcheng commentedon Jan 17, 2024
I created a pr here: apache/pulsar#21912, and built a jar based on it, could you add it to your runner image to check whether the issue is resolved? @graysonzeng
jiangpengcheng commentedon Jan 23, 2024
This issue is hard to fix since we cannot use different producer name to ensure the de-duplication. Below is a workaround when the error happens:
cc @graysonzeng
graysonzeng commentedon Jan 24, 2024
Thanks for the suggestion. I have an idea, how about using independent subscription names for each pod. For example, I have 10 partitions on the consumer side and two pods for consumption. Then, my two pods set subscription names A and B respectively. After this, even if the pod fails, the subscription will not be switched to other surviving pods due to failover, and it can continue to consume when the pod is pulled up by kubernetes. @jiangpengcheng
jiangpengcheng commentedon Jan 24, 2024
with different sub names will make podA and podB both consume all ten partitions and lead to duplication
graysonzeng commentedon Jan 24, 2024
A and B consume part of the partitions respectively. For example, A consumes partitions 0-4 and B consumes partitions 5-9. This will not lead to duplication.
jiangpengcheng commentedon Jan 25, 2024
this needs to be specified manually, which is just like what you do now:
graysonzeng commentedon Jan 30, 2024
Thanks . I originally thought that the creation of subscription does not need to be specified manually. In this way, the user can create a sink with mutil-replicas. No need to configure multiple configurations in yaml repeatedly. But it seems like this is the only way it can be for now @jiangpengcheng