If another request came in on a particular connection while the previous
request was still being processed, unixctl_server_wait() would wake up the
main loop but unixctl_server_run() wouldn't read the request, resulting in
100% CPU use.

I doubt whether this is a real problem because it's unusual for a client
to attempt to make requests in parallel.  I found it while pursuing a 100%
CPU issue but it turned out not to be a bug (the 100% CPU was caused by
a client making requests as fast as possible).

Signed-off-by: Ben Pfaff <[email protected]>
---
 lib/unixctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/unixctl.c b/lib/unixctl.c
index 730bd043a9ff..0bcfada9187d 100644
--- a/lib/unixctl.c
+++ b/lib/unixctl.c
@@ -409,7 +409,7 @@ unixctl_server_wait(struct unixctl_server *server)
     pstream_wait(server->listener);
     LIST_FOR_EACH (conn, node, &server->conns) {
         jsonrpc_wait(conn->rpc);
-        if (!jsonrpc_get_backlog(conn->rpc)) {
+        if (!jsonrpc_get_backlog(conn->rpc) && !conn->request_id) {
             jsonrpc_recv_wait(conn->rpc);
         }
     }
-- 
2.16.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to