Repository navigation
Closed
Description
Search before asking
- I searched in the issues and found nothing similar.
Version
commit id:
b35ae1aa and af45a54c
Minimal reproduce step
step1:
Create a partitioned topic.(In my environment, 16 partitions are used.)
step2:
Many Consumers connect to partitioned topic.(In my environment, 200 Consumers connected to partitioned topic.)
Each Consumer connects to a different subscription.
step3:
Repeat Broker restart until segmentation fault occurs.
What did you expect to see?
Consumer reconnection succeeds.
What did you see instead?
Segmentation fault occurs.
Anything else?
This issue did not occur in 84ac6fb9.
Perhaps one of the commits between 787bfd0e and b35ae1aa caused this issue.
Client logs are as follows.
2023-10-05 09:03:17.711 INFO [140211864341184] Client:90 | Subscribing on Topic :persistent://shustsud-test2/test/partitioned-topic
2023-10-05 09:03:17.711 INFO [140211864341184] ClientConnection:187 | [<none> -> pulsar+ssl://<host(vip)>:<prot>] Create ClientConnection, timeout=10000
2023-10-05 09:03:17.721 INFO [140211864341184] ConnectionPool:107 | Created connection for pulsar+ssl://<host(vip)>:<prot>
2023-10-05 09:03:17.726 INFO [140211814409984] ClientConnection:397 | [<host(client)>:44036 -> <host(vip)>:<prot>] Connected to broker
2023-10-05 09:03:17.756 INFO [140211814409984] HandlerBase:80 | [0x7f8594000ed0, dummy_18, 0] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f859402a240, dummy_18, 1] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594017d40, dummy_18, 2] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594035920, dummy_18, 3] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594017870, dummy_18, 4] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f85940476b0, dummy_18, 5] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f85940125b0, dummy_18, 6] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594053430, dummy_18, 7] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f85940594b0, dummy_18, 8] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f859405f480, dummy_18, 9] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594065450, dummy_18, 10] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f859406b210, dummy_18, 11] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594071250, dummy_18, 12] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594077220, dummy_18, 13] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f859407cfe0, dummy_18, 14] Getting connection from pool
2023-10-05 09:03:17.757 INFO [140211814409984] HandlerBase:80 | [0x7f8594057f20, dummy_18, 15] Getting connection from pool
2023-10-05 09:03:17.758 INFO [140211814409984] ClientConnection:187 | [<none> -> pulsar+ssl://<host(broker2)>:<prot>] Create ClientConnection, timeout=10000
2023-10-05 09:03:17.766 INFO [140211814409984] ConnectionPool:107 | Created connection for pulsar+ssl://<host(broker2)>:<prot>
2023-10-05 09:03:17.767 INFO [140211814409984] ClientConnection:397 | [<host(client)>:49870 -> <host(broker2)>:<prot>] Connected to broker
2023-10-05 09:03:17.772 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594000ed0, dummy_18, 0] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.772 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 15
2023-10-05 09:03:17.772 INFO [140211814409984] ConsumerImpl:282 | [0x7f859402a240, dummy_18, 1] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.772 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 14
2023-10-05 09:03:17.772 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594017d40, dummy_18, 2] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.772 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 13
2023-10-05 09:03:17.773 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594035920, dummy_18, 3] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.773 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 12
2023-10-05 09:03:17.773 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594017870, dummy_18, 4] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.773 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 11
2023-10-05 09:03:17.773 INFO [140211814409984] ConsumerImpl:282 | [0x7f85940476b0, dummy_18, 5] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.773 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 10
2023-10-05 09:03:17.773 INFO [140211814409984] ConsumerImpl:282 | [0x7f85940125b0, dummy_18, 6] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.773 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 9
2023-10-05 09:03:17.773 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594053430, dummy_18, 7] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.773 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 8
2023-10-05 09:03:17.773 INFO [140211814409984] ConsumerImpl:282 | [0x7f85940594b0, dummy_18, 8] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.773 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 7
2023-10-05 09:03:17.774 INFO [140211814409984] ConsumerImpl:282 | [0x7f859405f480, dummy_18, 9] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.774 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 6
2023-10-05 09:03:17.774 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594065450, dummy_18, 10] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.774 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 5
2023-10-05 09:03:17.774 INFO [140211814409984] ConsumerImpl:282 | [0x7f859406b210, dummy_18, 11] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.774 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 4
2023-10-05 09:03:17.774 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594071250, dummy_18, 12] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.774 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 3
2023-10-05 09:03:17.774 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594077220, dummy_18, 13] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.774 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 2
2023-10-05 09:03:17.775 INFO [140211814409984] ConsumerImpl:282 | [0x7f859407cfe0, dummy_18, 14] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.775 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 1
2023-10-05 09:03:17.775 INFO [140211814409984] ConsumerImpl:282 | [0x7f8594057f20, dummy_18, 15] Created consumer on broker [<host(client)>:49870 -> <host(broker2)>:<prot>]
2023-10-05 09:03:17.775 INFO [140211814409984] MultiTopicsConsumerImpl:303 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 0
2023-10-05 09:03:17.775 INFO [140211814409984] MultiTopicsConsumerImpl:146 | Successfully Subscribed to Topics
2023-10-05 09:06:56.935 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 12
2023-10-05 09:06:56.935 INFO [140211814409984] HandlerBase:140 | [0x7f8594071250, dummy_18, 12] Schedule reconnection in 0.1 s
2023-10-05 09:06:56.960 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 4
2023-10-05 09:06:56.960 INFO [140211814409984] HandlerBase:140 | [0x7f8594017870, dummy_18, 4] Schedule reconnection in 0.1 s
2023-10-05 09:06:56.986 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 8
2023-10-05 09:06:56.986 INFO [140211814409984] HandlerBase:140 | [0x7f85940594b0, dummy_18, 8] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.011 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 0
2023-10-05 09:06:57.011 INFO [140211814409984] HandlerBase:140 | [0x7f8594000ed0, dummy_18, 0] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.209 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 7
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:140 | [0x7f8594053430, dummy_18, 7] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:80 | [0x7f8594071250, dummy_18, 12] Getting connection from pool
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:80 | [0x7f8594017870, dummy_18, 4] Getting connection from pool
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:80 | [0x7f85940594b0, dummy_18, 8] Getting connection from pool
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:80 | [0x7f8594000ed0, dummy_18, 0] Getting connection from pool
2023-10-05 09:06:57.209 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 11
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:140 | [0x7f859406b210, dummy_18, 11] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.209 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 15
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:140 | [0x7f8594057f20, dummy_18, 15] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.209 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 3
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:140 | [0x7f8594035920, dummy_18, 3] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.209 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 10
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:140 | [0x7f8594065450, dummy_18, 10] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.209 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 2
2023-10-05 09:06:57.209 INFO [140211814409984] HandlerBase:140 | [0x7f8594017d40, dummy_18, 2] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.209 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 14
2023-10-05 09:06:57.210 INFO [140211814409984] HandlerBase:140 | [0x7f859407cfe0, dummy_18, 14] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.210 INFO [140211814409984] ClientConnection:187 | [<none> -> pulsar+ssl://<host(broker1)>:<prot>] Create ClientConnection, timeout=10000
2023-10-05 09:06:57.616 INFO [140211814409984] ConnectionPool:107 | Created connection for pulsar+ssl://<host(broker1)>:<prot>
2023-10-05 09:06:57.616 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 6
2023-10-05 09:06:57.616 INFO [140211814409984] HandlerBase:140 | [0x7f85940125b0, dummy_18, 6] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.616 INFO [140211814409984] HandlerBase:80 | [0x7f8594053430, dummy_18, 7] Getting connection from pool
2023-10-05 09:06:57.616 INFO [140211814409984] HandlerBase:80 | [0x7f859406b210, dummy_18, 11] Getting connection from pool
2023-10-05 09:06:57.616 INFO [140211814409984] HandlerBase:80 | [0x7f8594057f20, dummy_18, 15] Getting connection from pool
2023-10-05 09:06:57.616 INFO [140211814409984] HandlerBase:80 | [0x7f8594035920, dummy_18, 3] Getting connection from pool
2023-10-05 09:06:57.617 INFO [140211814409984] HandlerBase:80 | [0x7f8594065450, dummy_18, 10] Getting connection from pool
2023-10-05 09:06:57.617 INFO [140211814409984] HandlerBase:80 | [0x7f8594017d40, dummy_18, 2] Getting connection from pool
2023-10-05 09:06:57.617 INFO [140211814409984] HandlerBase:80 | [0x7f859407cfe0, dummy_18, 14] Getting connection from pool
2023-10-05 09:06:57.617 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 5
2023-10-05 09:06:57.617 INFO [140211814409984] HandlerBase:140 | [0x7f85940476b0, dummy_18, 5] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.617 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 13
2023-10-05 09:06:57.617 INFO [140211814409984] HandlerBase:140 | [0x7f8594077220, dummy_18, 13] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.617 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 9
2023-10-05 09:06:57.617 INFO [140211814409984] HandlerBase:140 | [0x7f859405f480, dummy_18, 9] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.617 INFO [140211814409984] ConsumerImpl:1207 | Broker notification of Closed consumer: 1
2023-10-05 09:06:57.617 INFO [140211814409984] HandlerBase:140 | [0x7f859402a240, dummy_18, 1] Schedule reconnection in 0.1 s
2023-10-05 09:06:57.617 INFO [140211814409984] ClientConnection:397 | [<host(client)>:49194 -> <host(broker1)>:<prot>] Connected to broker
2023-10-05 09:06:57.617 ERROR [140211814409984] ClientConnection:1330 | [<host(client)>:49870 -> <host(broker2)>:<prot>] Connection closed with ConnectError
2023-10-05 09:06:57.617 INFO [140211814409984] ConnectionPool:122 | Remove connection for pulsar+ssl://<host(broker2)>:<prot>
2023-10-05 09:06:57.617 INFO [140211814409984] ClientConnection:267 | [<host(client)>:49870 -> <host(broker2)>:<prot>] Destroyed connection to pulsar+ssl://<host(broker2)>:<prot>
2023-10-05 09:06:57.618 WARN [140211814409984] ClientConnection:1135 | [<host(client)>:44036 -> <host(vip)>:<prot>] Could not send message on connection: system:32 Broken pipe
2023-10-05 09:06:57.619 ERROR [140211814409984] ClientConnection:1330 | [<host(client)>:44036 -> <host(vip)>:<prot>] Connection closed with ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] ConnectionPool:122 | Remove connection for pulsar+ssl://<host(vip)>:<prot>
2023-10-05 09:06:57.619 ERROR [140211814409984] BinaryProtoLookupService:68 | Lookup failed for persistent://shustsud-test2/test/partitioned-topic-partition-7, result ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] HandlerBase:140 | [0x7f8594053430, dummy_18, 7] Schedule reconnection in 0.196 s
2023-10-05 09:06:57.619 ERROR [140211814409984] BinaryProtoLookupService:68 | Lookup failed for persistent://shustsud-test2/test/partitioned-topic-partition-11, result ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] HandlerBase:140 | [0x7f859406b210, dummy_18, 11] Schedule reconnection in 0.196 s
2023-10-05 09:06:57.619 ERROR [140211814409984] BinaryProtoLookupService:68 | Lookup failed for persistent://shustsud-test2/test/partitioned-topic-partition-15, result ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] HandlerBase:140 | [0x7f8594057f20, dummy_18, 15] Schedule reconnection in 0.196 s
2023-10-05 09:06:57.619 ERROR [140211814409984] BinaryProtoLookupService:68 | Lookup failed for persistent://shustsud-test2/test/partitioned-topic-partition-3, result ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] HandlerBase:140 | [0x7f8594035920, dummy_18, 3] Schedule reconnection in 0.196 s
2023-10-05 09:06:57.619 ERROR [140211814409984] BinaryProtoLookupService:68 | Lookup failed for persistent://shustsud-test2/test/partitioned-topic-partition-10, result ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] HandlerBase:140 | [0x7f8594065450, dummy_18, 10] Schedule reconnection in 0.196 s
2023-10-05 09:06:57.619 ERROR [140211814409984] BinaryProtoLookupService:68 | Lookup failed for persistent://shustsud-test2/test/partitioned-topic-partition-2, result ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] HandlerBase:140 | [0x7f8594017d40, dummy_18, 2] Schedule reconnection in 0.196 s
2023-10-05 09:06:57.619 ERROR [140211814409984] BinaryProtoLookupService:68 | Lookup failed for persistent://shustsud-test2/test/partitioned-topic-partition-14, result ConnectError
2023-10-05 09:06:57.619 INFO [140211814409984] HandlerBase:140 | [0x7f859407cfe0, dummy_18, 14] Schedule reconnection in 0.196 s
2023-10-05 09:06:57.619 INFO [140211814409984] ClientConnection:267 | [<host(client)>:44036 -> <host(vip)>:<prot>] Destroyed connection to pulsar+ssl://<host(vip)>:<prot>
Segmentation fault
Are you willing to submit a PR?
- I'm willing to submit a PR!
Metadata
Metadata
Assignees
Labels
No labels
Activity
BewareMyPower commentedon Oct 7, 2023
I also observed a similar segfault recently. It happened randomly.
A failed case:
A successful case:
BewareMyPower commentedon Oct 7, 2023
The root cause might be b35ae1a, I reverted this commit and then the segmentation fault never happened. I will investigate the reason.
BewareMyPower commentedon Oct 8, 2023
@shustsud Could you try my patch here to see whether it's fixed?
shustsud commentedon Oct 16, 2023
@BewareMyPower
Thank you for your comment.
I tried 5c77648 , but this issue(Segmentation fault) still seems to occur.
BewareMyPower commentedon Oct 16, 2023
Maybe it's better to upload the stacktrace from the core dump.
In my test environment the segfault never happened after that commit.
BewareMyPower commentedon Oct 16, 2023
In addition, you can try capturing the
shared_ptrinstead ofweak_ptrinasyncReceivebecause your scenario has many consumers while my test environment has many producers. I'm not sure the same issue stands forasync_receivelikeasync_write. If it works, you can open a PR.shustsud commentedon Oct 17, 2023
The stacktrace extracted from the core dump is as follows.
As per the stacktrace, this issue may be occurring in
async_receive(readNextCommand).BewareMyPower commentedon Oct 19, 2023
Yes, we observed similar segmentation faults as well :(
I will push a similar fix as well
Fix segmentation fault caused by async_receive
BewareMyPower commentedon Oct 19, 2023
Could you try #330?
Fix segmentation fault caused by async_receive (#330)
Fix segmentation fault caused by async_receive (apache#330)
shustsud commentedon Oct 23, 2023
Thank you for fixing the issue.
This issue has been resolved by #330, so this issue will be closed.