WebDAV issues (upload and stream reset) and solution

Posting this to report a bug and help anyone else with a similar issue on the solution.

I was having trouble with the WebDAV component. Uploading larger file sets the stream would be reset. My configuration was behind an Nginx proxy. Nginx logs would show that the upstream connection would be reset. Essentially the client was getting a 502 error. It took a bit of reviewing logs and digging into the code to find out the problem.

The Seafdav component uses WSGIDav and spins up a gunicorn instance to support it. Now Seahub already uses gunicorn and I expected the gunicorn.conf.py configuration file to handle this, but for WebDAV a separate gunicorn server is started and it uses a different configuration. In fact the configuration is not defined in any file but inside the python code.

This means that the worker timeout is the default 30s and not the bigger number as seen in gunicorn.conf.py. For WebDav similar settings for gunicorn should be in place as those for Seahub and this is the bug.

For anyone encountering problems with WebDAV please look at seafile-server-latest/seahub/thirdpart/wsgidav/server/server_cli.py You will want to look for the section

def _run_gunicorn(app, config, mode):
options = {
    'bind': '%s:%s' % (config.get('host'), config.get('port')),
    'workers': 5,
    "pidfile": config.get('pidfile'),
}

In Seafile Pro 7.1.4 it is at line 501.

Within the options bit insert the necessary options. In this case I needed ‘timeout’: 1200,. You can add whatever other gunicorn options as necessary. Save the file and restart the services.

With this modification in place I was able to properly run WebDAV operations without having any problems with larger data sets.

4 Likes

Thanks for posting this. Just for reference in 7.1.4 CE I have the path:

seafile-server-latest/seahub/thirdpart/wsgidav/server/server_cli.py

Hi, I think I can confirm this, changing the options fixes the timeout problems for me.

I can confirm this solved the same problem for me, thanks for posting ! could I suggest this also gets lengthened in the original source (who knows if I’ll remember this when I next upgrade lol)

@daniel.pan is there any way to configure this without having to reconfigure it with every update?

We will check the problem and may add the patch to the main code.

1 Like