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

NetVC is lost from read or write enable_list

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2.1, 7.1.0
    • Component/s: Network
    • Labels:
      None
    • Backport to Version:

      Description

      The related code here:

      void
      UnixNetVConnection::reenable(VIO *vio)
      {
        if (STATE_FROM_VIO(vio)->enabled)
          return;
        set_enabled(vio);
        if (!thread)
          return;
        EThread *t = vio->mutex->thread_holding;
        ink_assert(t == this_ethread());
        ink_release_assert(!closed);
        if (nh->mutex->thread_holding == t) { 
      ...
          MUTEX_TRY_LOCK(lock, nh->mutex, t);
          if (!lock.is_locked()) {
            if (vio == &read.vio) {
              if (!read.in_enabled_list) {    // -----------> the condition check is not atomic
                read.in_enabled_list = 1;   // -----------> the variable set is not atomic
                nh->read_enable_list.push(this);
              }
            } else {
              if (!write.in_enabled_list) {   // -----------> the write side 
                write.in_enabled_list = 1;  // -----------> the write side
                nh->write_enable_list.push(this);
              }
            }
            if (nh->trigger_event && nh->trigger_event->ethread->signal_hook)
              nh->trigger_event->ethread->signal_hook(nh->trigger_event->ethread);
          } else {
      ...
          }
        }
      }
      

      Due to the unstable condition check code, the nh->read_enable_list.push(this) would push a netvc into atomic queue that is already inside a queue.

      It leads the elements in atomic queue after the netvc will be lost.

        Attachments

          Activity

            People

            • Assignee:
              oknet Chao Xu
              Reporter:
              oknet Chao Xu
            • Votes:
              0 Vote for this issue
              Watchers:
              6 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 - 3.5h
                3.5h