You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "masaori335 (via GitHub)" <gi...@apache.org> on 2024/04/18 07:45:41 UTC

[PR] Add nullptr guards in ActivityCop functions [trafficserver]

masaori335 opened a new pull request, #11266:
URL: https://github.com/apache/trafficserver/pull/11266

   Possible fix of #11265. I still don't get root cause of crash, but checking `_event` might work as workaround. IMO, ASan build will find the root cause.
   
   


-- 
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] Add nullptr guards in ActivityCop functions [trafficserver]

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 merged PR #11266:
URL: https://github.com/apache/trafficserver/pull/11266


-- 
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] Add nullptr guards in ActivityCop functions [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #11266:
URL: https://github.com/apache/trafficserver/pull/11266#issuecomment-2079603378

   Cherry-picked to v10.0.x


-- 
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] Add nullptr guards in ActivityCop functions [trafficserver]

Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #11266:
URL: https://github.com/apache/trafficserver/pull/11266#discussion_r1571000132


##########
include/iocore/net/NetTimeout.h:
##########
@@ -219,14 +219,18 @@ template <class T, class List>
 inline void
 ActivityCop<T, List>::start()
 {
-  _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  if (_event == nullptr) {
+    _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  }
 }
 
 template <class T, class List>
 inline void
 ActivityCop<T, List>::stop()
 {
-  _event->cancel();
+  if (_event != nullptr) {
+    _event->cancel();

Review Comment:
   We won't be able to restart this? Why don't you set `nullptr` after cancelling the event?



-- 
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] Add nullptr guards in ActivityCop functions [trafficserver]

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on code in PR #11266:
URL: https://github.com/apache/trafficserver/pull/11266#discussion_r1571498040


##########
include/iocore/net/NetTimeout.h:
##########
@@ -219,14 +219,18 @@ template <class T, class List>
 inline void
 ActivityCop<T, List>::start()
 {
-  _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  if (_event == nullptr) {
+    _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  }
 }
 
 template <class T, class List>
 inline void
 ActivityCop<T, List>::stop()
 {
-  _event->cancel();
+  if (_event != nullptr) {
+    _event->cancel();

Review Comment:
   Sure



-- 
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