]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/OutputDataSocket: actually discard data on full buffer 29279/head
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 5 Jun 2019 17:25:32 +0000 (13:25 -0400)
committerNathan Cutler <ncutler@suse.com>
Wed, 24 Jul 2019 14:44:54 +0000 (16:44 +0200)
A dout message in OutputDataSocket::append_output() states that
data will be dropped when appending would cause data_max_backlog
to be exceeded--but the method appends it anyway.

Log output discards at level 0, as messages will be lost.  Suppress
repeated warnings mod 100.  Switch to vector.

Fixes: http://tracker.ceph.com/issues/40178
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit c806b825dae649829de8847d36cb21ffd2bbee8e)

Conflicts:
src/common/OutputDataSocket.cc
src/common/OutputDataSocket.h

src/common/OutputDataSocket.cc
src/common/OutputDataSocket.h

index f2244cde84b82513c7d313ebfb278a1a1955022a..12b9377d420ad8f4468871fd80506b16863db83e 100644 (file)
@@ -92,6 +92,7 @@ OutputDataSocket::OutputDataSocket(CephContext *cct, uint64_t _backlog)
     m_shutdown_wr_fd(-1),
     going_down(false),
     data_size(0),
+    skipped(0),
     m_lock("OutputDataSocket::m_lock")
 {
 }
@@ -290,12 +291,12 @@ void OutputDataSocket::handle_connection(int fd)
 int OutputDataSocket::dump_data(int fd)
 {
   m_lock.Lock(); 
-  list<bufferlist> l = std::move(data);
+  vector<buffer::list> l = std::move(data);
   data.clear();
   data_size = 0;
   m_lock.Unlock();
 
-  for (list<bufferlist>::iterator iter = l.begin(); iter != l.end(); ++iter) {
+  for (auto iter = l.begin(); iter != l.end(); ++iter) {
     bufferlist& bl = *iter;
     int ret = safe_write(fd, bl.c_str(), bl.length());
     if (ret >= 0) {
@@ -384,11 +385,17 @@ void OutputDataSocket::append_output(bufferlist& bl)
   Mutex::Locker l(m_lock);
 
   if (data_size + bl.length() > data_max_backlog) {
-    ldout(m_cct, 20) << "dropping data output, max backlog reached" << dendl;
+    if (skipped % 100 == 0) {
+      ldout(m_cct, 0) << "dropping data output, max backlog reached (skipped=="
+                     << skipped << ")"
+                     << dendl;
+      skipped = 1;
+    } else
+      ++skipped;
+    return;
   }
-  data.push_back(bl);
 
+  data.push_back(bl);
   data_size += bl.length();
-
   cond.Signal();
 }
index 0bce1ded790de82f8a2702a72fd362331b632bf5..7e5897102873a56f74d5cf811de1f9b162dd6fd0 100644 (file)
@@ -53,13 +53,13 @@ protected:
   bool going_down;
 
   uint64_t data_size;
+  uint32_t skipped;
 
-  std::list<bufferlist> data;
+  std::vector<buffer::list> data;
 
   Mutex m_lock;
   Cond cond;
-
-  bufferlist delim;
+  buffer::list delim;
 };
 
 #endif