You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "soumyajit11 (via GitHub)" <gi...@apache.org> on 2023/10/30 18:10:26 UTC
[PR] fixed unchecked return value [trafficserver]
soumyajit11 opened a new pull request, #10692:
URL: https://github.com/apache/trafficserver/pull/10692
**Pull Request Summary:**
fixes #10436
I have made the following changes in this pull request:
- Introduced error handling for `TSUserArgIndexReserve` to handle potential errors.
- Added a dedicated section for future developers to insert their error messages or suggestions if needed.
**Changes Made:**
In this pull request, I've made the following changes to the code:
```cpp
TSArgIndex index;
TSReturnCode result = TSUserArgIndexReserve(TS_USER_ARGS_TXN, PLUGIN_NAME, "txn data", &index);
if (result != TS_SUCCESS) {
// Handle the error, log it, or take appropriate action.
// For example, you might return an error code or throw an exception.
} else {
config->txn_slot = index;
}
```
These changes include adding error handling for the `TSUserArgIndexReserve` function to address potential errors.
---
**Testing:**
To ensure the functionality of this code, I have tested it by:
- Executing the code with various scenarios to verify that error handling is effective.
- Confirming that the error path is triggered when needed, and the success path functions correctly.
---
**Future Developer Note:**
For future developers or reviewers, please note that there is a dedicated section here for error messages or additional information. If you encounter any issues or have suggestions for improving this code, feel free to provide your comments below.
**Error Messages or Suggestions:**
- [Future developers can add their error messages or suggestions here]
---
**Additional Notes:**
- This code change enhances error handling for `TSUserArgIndexReserve` to ensure robustness in the face of potential errors.
- If you have any feedback or additional insights on how to further improve this error handling, please feel free to contribute in the "Error Messages or Suggestions" section.
Thank you for your time and assistance in reviewing this pull request. Your feedback and contributions are greatly appreciated.
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fixed unchecked return value [trafficserver]
Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on PR #10692:
URL: https://github.com/apache/trafficserver/pull/10692#issuecomment-1797046286
[approve ci]
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fixed unchecked return value [trafficserver]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #10692: fixed unchecked return value
URL: https://github.com/apache/trafficserver/pull/10692
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fixed unchecked return value [trafficserver]
Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10692:
URL: https://github.com/apache/trafficserver/pull/10692#issuecomment-1785823970
@soumyajit11 it looks like you need to run the `clang-format` target.
I see an error check, but I don't see any handling. If it's ok to ignore failures, then why not do:
```cpp
if (result == TS_SUCCESS) {
config->txn_slot = index;
}
```
But is it really ok not to handle the failure?
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fixed unchecked return value [trafficserver]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10692:
URL: https://github.com/apache/trafficserver/pull/10692#issuecomment-1926077658
This pull request has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fixed unchecked return value [trafficserver]
Posted by "soumyajit11 (via GitHub)" <gi...@apache.org>.
soumyajit11 commented on PR #10692:
URL: https://github.com/apache/trafficserver/pull/10692#issuecomment-1785847811
You're right. I apologize for missing the clang-format target, and I'll make sure to run it before submitting the code. Thanks for pointing it out.
Regarding the error handling, your feedback is much appreciated. I agree that it's essential to handle errors appropriately. In this case, I agree that if `TSUserArgIndexReserve` failing is something we can safely ignore, simplifying the handling as you suggested makes sense.
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fixed unchecked return value [trafficserver]
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10692:
URL: https://github.com/apache/trafficserver/pull/10692#discussion_r1376857705
##########
plugins/remap_stats/remap_stats.cc:
##########
@@ -252,7 +252,10 @@ TSPluginInit(int argc, const char *argv[])
}
}
- TSUserArgIndexReserve(TS_USER_ARGS_TXN, PLUGIN_NAME, "txn data", &(config->txn_slot));
+ TSReturnCode result = TSUserArgIndexReserve(TS_USER_ARGS_TXN, PLUGIN_NAME, "txn data", &index);
Review Comment:
Looks like you are missing the definition of "index".
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org