]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
msg/async: add comments for commit 294c41f18adada6ab.
authorJianpeng Ma <jianpeng.ma@intel.com>
Mon, 24 Jun 2019 12:24:36 +0000 (20:24 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Mon, 24 Jun 2019 12:24:36 +0000 (20:24 +0800)
commit0d13ef2f2013b201f09d67c86f34253fb86cd736
tree4b13e395bc387938a3744d9361bc425225dd407c
parent90022b35ab4835948372253ec2339b2f323bfe08
msg/async: add comments for commit 294c41f18adada6ab.

Consider this case:
    send-thread                                 msg-work
                                            write_event()
                                             r = write_message()
connection->write_lock.lock()
if (.. && !write_in_progress) {
  write_in_progress = true;
  add external_event
}
connection->write_lock.unlock()
                                          connection->write_lock.lock()
                                          if (r > 0)
                                            break;
                                          } while ();
                                          write_in_progress = false;

For this case, we don't add external_event and in write_event we don't
check out_q whether empty rather than break.
This make msg-work never wake up again.
Fortunately, if write_message() > 0, in AsyncConnection::_try_send will
add an EVENT_WRITEABLE to wake up msg-work. So bug can't occur.

I add comment to descript this and hope get the better method to fix
this.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/msg/async/ProtocolV1.cc
src/msg/async/ProtocolV2.cc