summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorliuyacan <liuyacan@corp.netease.com>2021-07-24 14:30:51 +0800
committerliuyacan <liuyacan@corp.netease.com>2021-07-24 14:50:07 +0800
commit9609e26f8712246f62d54c1178aefce57e3b6c06 (patch)
tree2390801691c7bb4628ec0ebf22f2d483e697c420 /src
parent7cb471a0279ab2a3740a49d6ce9cf7b24f0a3f4d (diff)
session: avoid vpp deadlock due to app crash
In high traffic scenarios, if app crashed or hang on somewhere, app_mq will quickly accumulate to full, after which vpp worker will try 100 times before giving up allocating slot for every msg. This will cause vpp main thread barrier sync to fail. Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I2b2bf2b272c5b3ca7e4a56af179af12bbcde149d
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/session_api.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 7e7cffbbdd4..00e67dcd2d0 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -93,6 +93,12 @@ mq_try_lock_and_alloc_msg (svm_msg_q_t * app_mq, svm_msg_q_msg_t * msg)
SVM_Q_NOWAIT, msg);
if (!rv)
return 0;
+ /*
+ * Break the loop if mq is full, usually this is because the
+ * app has crashed or is hanging on somewhere.
+ */
+ if (rv != -1)
+ break;
try++;
usleep (1);
}