[gvfs/gnome-3-28] dav: Increase max number of connections to prevent lockups



commit 4a0f41d55f97a8549ef525258900dfb3ce56be6b
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Jul 26 10:36:08 2018 +0200

    dav: Increase max number of connections to prevent lockups
    
    Currently, the default value of max-conns-per-host libsoup property is
    used, which causes dav backend lockups if two files are opened. I don't
    see any easy solution how to prevent lockups, but we can definitely
    reduce the chance of them by increasing max-conns properties. Much bigger
    values are used by browsers nowadays. Hope that 32 is big enough for
    regular use cases and small enough to not flood a server and not block
    too much file descriptors...
    
    Closes: https://gitlab.gnome.org/GNOME/gvfs/issues/6

 daemon/gvfsbackenddav.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index 967f1db4..4382d1b1 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -66,6 +66,10 @@
 #include "gvfsdnssdresolver.h"
 #endif
 
+/* Overwrite maximal number of connections that libsoup can open in one time in
+   order to prevent backend lockups when too many files is opened concurrently. */
+#define MAX_CONNS 32
+
 typedef struct _MountAuthData MountAuthData;
 
 static void mount_auth_info_free (MountAuthData *info);
@@ -1868,7 +1872,11 @@ do_mount (GVfsBackend  *backend,
   G_VFS_BACKEND_HTTP (backend)->mount_base = mount_base; 
 
   /* Override the HTTP backend's default. */
-  g_object_set (session, "ssl-strict", TRUE, NULL);
+  g_object_set (session,
+                "ssl-strict", TRUE,
+                SOUP_SESSION_MAX_CONNS_PER_HOST, MAX_CONNS,
+                SOUP_SESSION_MAX_CONNS, MAX_CONNS,
+                NULL);
 
   data = &(G_VFS_BACKEND_DAV (backend)->auth_info); 
   data->mount_source = g_object_ref (mount_source);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]