dynomite icon indicating copy to clipboard operation
dynomite copied to clipboard

Ignores NULL returned by msg_get_error to avoid segfault crash

Open rprevot opened this issue 4 months ago • 0 comments

Hi,

This pull request fixes #592.

Note that msg_get_error() may return a NULL pointer when :

  1. Client requests are dropped under heavy traffic (call stack : req_forward_error => msg_get_error => _msg_get) :
    static struct msg *_msg_get(struct conn *conn, bool request,
                                const char *const caller) {
      struct msg *msg;

      // .........
    
      // protect our server in the slow network and high traffics.
      // we drop client requests but still honor our peer requests
      if (alloc_msg_count >= alloc_msgs_max) {
        log_debug(LOG_WARN, "allocated #msgs %lu hit max allowable limit",
                  alloc_msg_count);
        return NULL;
      }

      // .........
  1. Response message cannot be allocated.

Consequently, there is really no other solution than to ignore the NULL pointer and not forward the error.

rprevot avatar Sep 12 '25 17:09 rprevot