void-ptr974 opened a new pull request, #25732:
URL: https://github.com/apache/pulsar/pull/25732
### Motivation
`ShadowReplicator` was retaining the source entry `headersAndPayload`
buffer before sending the replicated message. Unlike geo replication, shadow
replication deserializes source entries
with an empty payload, so the producer send path does not own or release
the original source entry buffer.
This left one extra reference after the send callback released the
`Entry`, causing Netty leak detector reports like:
`LEAK: ByteBuf.release() was not called`
### Changes
- Remove the unnecessary `headersAndPayload.retain()` in
`ShadowReplicator`.
- Add a regression test that exercises the `ShadowReplicator` send path
and verifies the source entry `ByteBuf` `refCnt` reaches `0` after replication
completes.
### Verification
```bash
./gradlew :pulsar-broker:test --tests
org.apache.pulsar.broker.service.persistent.ShadowReplicatorTest
Also verified the new test fails before the fix with expected [0] but
found [1].
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]