Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-4885

Incorrect checking of fds_throttle and fds_limit

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2.1, 7.0.0
    • Component/s: Core
    • Labels:
      None

      Description

       902 static void
       903 check_fd_limit()
       904 {
       905   int fds_throttle = -1;
       906   REC_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
       907   if (fds_throttle > fds_limit + THROTTLE_FD_HEADROOM) {      // -------> Incorrect
       908     int new_fds_throttle = fds_limit - THROTTLE_FD_HEADROOM;
       909     if (new_fds_throttle < 1) {
       910       ink_abort("too few file descriptors (%d) available", fds_limit);
       911     }
       912     char msg[256];
       913     snprintf(msg, sizeof(msg), "connection throttle too high, "
       914                                "%d (throttle) + %d (internal use) > %d (file descriptor limit), "
       915                                "using throttle of %d",
       916              fds_throttle, THROTTLE_FD_HEADROOM, fds_limit, new_fds_throttle);
       917     SignalWarning(MGMT_SIGNAL_SYSTEM_ERROR, msg);
       918   }
       919 }
      
      1001 static void
      1002 adjust_sys_settings(void)
      1003 {
      ...
      1024   REC_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
      1025 
      1026   if (getrlimit(RLIMIT_NOFILE, &lim) == 0) {
      1027     if (fds_throttle > (int)(lim.rlim_cur + THROTTLE_FD_HEADROOM)) {  // ------> Incorrect
      1028       lim.rlim_cur = (lim.rlim_max = (rlim_t)fds_throttle);
      1029       if (setrlimit(RLIMIT_NOFILE, &lim) == 0 && getrlimit(RLIMIT_NOFILE, &lim) == 0) {
      1030         fds_limit = (int)lim.rlim_cur;
      1031         syslog(LOG_NOTICE, "NOTE: RLIMIT_NOFILE(%d):cur(%d),max(%d)", RLIMIT_NOFILE, (int)lim.rlim_cur, (int)lim.rlim_max);
      1032       }
      1033     }
      1034   }
      ...
      1043 }
      

        Attachments

          Activity

            People

            • Assignee:
              oknet Chao Xu
              Reporter:
              oknet Chao Xu
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m