You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/07/30 22:06:06 UTC
[GitHub] [pulsar] kaushik-develop opened a new pull request #11524: [Issue #11523] Check the BrokerInterceptor before de-ref in newMessag…
kaushik-develop opened a new pull request #11524:
URL: https://github.com/apache/pulsar/pull/11524
…eAndIntercept
<!--
### Contribution Checklist
- Name the pull request in the form "[Issue XYZ][component] Title of the pull request", where *XYZ* should be replaced by the actual issue number.
Skip *Issue XYZ* if there is no associated github issue for this pull request.
Skip *component* if you are unsure about which is the best component. E.g. `[docs] Fix typo in produce method`.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
**(The sections below can be removed for hotfixes of typos)**
-->
*(If this PR fixes a github issue, please add `Fixes #<xyz>`.)*
Fixes #11523
### Motivation
Try to avoid an NPE.
*Explain here the context, and why you're making that change. What is the problem you're trying to solve.*
While the de-ref is in a try/catch block (so the JVM doesn't quit), the exception causes noise and may slow down processing.
### Modifications
*Describe the modifications you've done.*
Check the BrokerInterceptor before de-ref-ing it.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
*(Please pick either of the following options)*
This change is a trivial rework / code cleanup without any test coverage.
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (10MB)*
- *Extended integration test for recovery after broker failure*
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
### Documentation
#### For contributor
For this PR, do we need to update docs?
No, this is an internal change.
#### For committer
For this PR, do we need to update docs?
No.
--
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
[GitHub] [pulsar] merlimat commented on a change in pull request #11524: [Issue #11523] Check the BrokerInterceptor before de-ref in newMessag…
Posted by GitBox <gi...@apache.org>.
merlimat commented on a change in pull request #11524:
URL: https://github.com/apache/pulsar/pull/11524#discussion_r680393493
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -2364,7 +2365,12 @@ public ByteBufPair newMessageAndIntercept(long consumerId, long ledgerId, long e
ackSet);
ByteBufPair res = Commands.serializeCommandMessageWithSize(command, metadataAndPayload);
try {
- getBrokerService().getInterceptor().onPulsarCommand(command, this);
+ val brokerInterceptor = getBrokerService().getInterceptor();
Review comment:
If `getInterceptor()` can return a null, it would also be good to return `Optional<Interceptor>` instead
--
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
[GitHub] [pulsar] kaushik-develop commented on pull request #11524: [Issue #11523] Check the BrokerInterceptor before de-ref in newMessag…
Posted by GitBox <gi...@apache.org>.
kaushik-develop commented on pull request #11524:
URL: https://github.com/apache/pulsar/pull/11524#issuecomment-890252325
/pulsarbot run-failure-checks
--
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
[GitHub] [pulsar] kaushik-develop commented on a change in pull request #11524: [Issue #11523] Check the BrokerInterceptor before de-ref in newMessag…
Posted by GitBox <gi...@apache.org>.
kaushik-develop commented on a change in pull request #11524:
URL: https://github.com/apache/pulsar/pull/11524#discussion_r680246016
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -2364,7 +2365,12 @@ public ByteBufPair newMessageAndIntercept(long consumerId, long ledgerId, long e
ackSet);
ByteBufPair res = Commands.serializeCommandMessageWithSize(command, metadataAndPayload);
try {
- getBrokerService().getInterceptor().onPulsarCommand(command, this);
+ val brokerInterceptor = getBrokerService().getInterceptor();
+ if (brokerInterceptor != null) {
+ brokerInterceptor.onPulsarCommand(command, this);
+ } else {
Review comment:
Since it is a debug thing, I hope it's ok to leave it there -- just in the unlikely case anyone was depending on an exception being raised. PLMK if you feel strongly otherwise.
--
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
[GitHub] [pulsar] jerrypeng commented on a change in pull request #11524: [Issue #11523] Check the BrokerInterceptor before de-ref in newMessag…
Posted by GitBox <gi...@apache.org>.
jerrypeng commented on a change in pull request #11524:
URL: https://github.com/apache/pulsar/pull/11524#discussion_r680244544
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -2364,7 +2365,12 @@ public ByteBufPair newMessageAndIntercept(long consumerId, long ledgerId, long e
ackSet);
ByteBufPair res = Commands.serializeCommandMessageWithSize(command, metadataAndPayload);
try {
- getBrokerService().getInterceptor().onPulsarCommand(command, this);
+ val brokerInterceptor = getBrokerService().getInterceptor();
+ if (brokerInterceptor != null) {
+ brokerInterceptor.onPulsarCommand(command, this);
+ } else {
Review comment:
I don't think we need this else statement
--
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
[GitHub] [pulsar] merlimat merged pull request #11524: [Issue #11523] Check the BrokerInterceptor before de-ref in newMessag…
Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #11524:
URL: https://github.com/apache/pulsar/pull/11524
--
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