You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "key-qinllin (via GitHub)" <gi...@apache.org> on 2026/10/15 09:30:31 UTC
[PR] [Issue 1546][producer] Fix pending item ownership race in send receipt handling [pulsar-client-go]
key-qinllin opened a new pull request, #1547:
URL: https://github.com/apache/pulsar-client-go/pull/1547
Fixes #1546
### Motivation
`ReceivedSendReceipt()` peeks at the pending queue and then polls it in a separate critical section. If a timeout, producer close, or another receipt claims the head item between these operations, the receipt handler can complete an already-recycled `sendRequest` and accidentally remove the next pending item.
This can cause a nil pointer panic, missing callbacks, and leaked memory and semaphore permits.
### Modifications
- Use `CompareAndPoll()` to atomically claim the exact pending item observed by the receipt handler.
- Ignore the receipt if another handler has already claimed the item.
- Check `isDone` under the pending item lock before completing requests.
- Add deterministic regression tests covering normal receipts, competing timeout/close/receipt handlers, duplicate receipts, and resource cleanup.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
Added regression tests that reproduce the panic with the original implementation and pass with the fix.
Passed locally:
- `go test -race ./pulsar -run '^TestReceivedSendReceipt' -count=100`
- `go test ./pulsar/internal -run '^TestBlockingQueue' -count=1`
Broker integration tests have not been run.
### Does this pull request potentially affect one of the following parts:
- Dependencies: no
- The public API: no
- The schema: no
- The default values of configurations: no
- The wire protocol: no
### Documentation
- Does this pull request introduce a new feature? no
- Documentation changes are not required for this internal concurrency fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue 1546][producer] Fix pending item ownership race in send receipt handling [pulsar-client-go]
Posted by "key-qinllin (via GitHub)" <gi...@apache.org>.
key-qinllin commented on PR #1547:
URL: https://github.com/apache/pulsar-client-go/pull/1547#issuecomment-6334513656
Hi @crossoverJie, could you please take a final look at this PR and help merge it when ready?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue 1546][producer] Fix pending item ownership race in send receipt handling [pulsar-client-go]
Posted by "crossoverJie (via GitHub)" <gi...@apache.org>.
crossoverJie merged PR #1547:
URL: https://github.com/apache/pulsar-client-go/pull/1547
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue 1546][producer] Fix pending item ownership race in send receipt handling [pulsar-client-go]
Posted by "key-qinllin (via GitHub)" <gi...@apache.org>.
key-qinllin commented on PR #1547:
URL: https://github.com/apache/pulsar-client-go/pull/1547#issuecomment-6296864975
@nodece I've merged upstream/master into this branch (713a968) to include the test fixes. Could you please approve or trigger CI for the latest commit? Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org