[Webdav] Large file upload ends in error

I’m connected to my Ubuntu Seafile 6.2.1 server with Webdav from another server. My seafile is using a Mysql backend and Nginx as proxy. Uploading files to the webdav is no problem, as long as they are not too large (and probably take too much time), but uploading large files fails.

I’ve tested with the nginx setting ‘proxy_request_buffering’ but on or off does not make a difference. I’ve set nginx proxy_send_timeout and read timeouts to 86400s, but also no effect.

I have no idea what is causing this error. Hopefully anyone has an idea what might cause this

[2017-09-28 01:10:50,936]:  e.srcexception:

[2017-09-28 01:10:51,457]:  Input stream not completely consumed: closing connection
[2017-09-28 01:10:51,457]:  Adding 'Connection: close' header
[2017-09-28 01:44:51,033]:  PUT: byte copy failed
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/wsgidav/request_server.py", line 720, in doPUT
    readbuffer = environ["wsgi.input"].read(n)
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/flup-1.0.2-py2.7.egg/flup/server/fcgi_base.py", line 161, in read
    self._waitForData()
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/flup-1.0.2-py2.7.egg/flup/server/fcgi_base.py", line 147, in _waitForData
    self._conn.process_input()
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/flup-1.0.2-py2.7.egg/flup/server/fcgi_base.py", line 673, in process_input
    rec.read(self._sock)
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/flup-1.0.2-py2.7.egg/flup/server/fcgi_base.py", line 492, in read
    raise EOFError
EOFError
[2017-09-28 01:44:51,167]:  Traceback (most recent call last):
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/wsgidav/error_printer.py", line 43, in __call__
    for v in app_iter:
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/wsgidav/request_resolver.py", line 201, in __call__
    for v in app_iter:
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/wsgidav/request_server.py", line 113, in __call__
    app_iter = method(environ, start_response)
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/wsgidav/request_server.py", line 738, in doPUT
    self._fail(e)
  File "/opt/seafile/seafile-server-6.2.1/seahub/thirdpart/wsgidav/request_server.py", line 128, in _fail
    raise e
DAVError: DAVError(500 Internal Server Error: An internal server error occurred
    Source exception: '')

[2017-09-28 01:44:51,167]:  e.srcexception:

[2017-09-28 01:44:52,192]:  Input stream not completely consumed: closing connection
[2017-09-28 01:44:52,199]:  Adding 'Connection: close' header

Nginx site

    location / {
            proxy_pass         http://127.0.0.1:8000;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;
            proxy_read_timeout 43200s;

            # used for view/edit office file via Office Online Server
            client_max_body_size 0;
    }

    location /seafhttp {
            rewrite ^/seafhttp(.*)$ $1 break;
            proxy_pass http://127.0.0.1:8082;
            client_max_body_size 0;
            proxy_connect_timeout 36000s;
            proxy_read_timeout 36000s;
            proxy_send_timeout 36000s;
            send_timeout 36000s;
    }

    location /seafdav {
            fastcgi_pass    127.0.0.1:8989;
            fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
            fastcgi_param   PATH_INFO           $fastcgi_script_name;

            fastcgi_param   SERVER_PROTOCOL     $server_protocol;
            fastcgi_param   QUERY_STRING        $query_string;
            fastcgi_param   REQUEST_METHOD      $request_method;
            fastcgi_param   CONTENT_TYPE        $content_type;
            fastcgi_param   CONTENT_LENGTH      $content_length;
            fastcgi_param   SERVER_ADDR         $server_addr;
            fastcgi_param   SERVER_PORT         $server_port;
            fastcgi_param   SERVER_NAME         $server_name;
            fastcgi_param   HTTPS               on;
            fastcgi_param   HTTP_SCHEME         https;

            client_max_body_size 0;
            proxy_connect_timeout  86400s;
            proxy_read_timeout  86400s;
            proxy_send_timeout  86400s;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            send_timeout  86400s;

            # This option is only available for Nginx >= 1.8.0. See more details below.
            proxy_request_buffering off;

            access_log      /var/log/nginx/seafile.seafdav.access.log;
            error_log       /var/log/nginx/seafile.seafdav.error.log;
    }

seafdav.conf

[WEBDAV]
enabled = true
port = 8989
fastcgi = true
share_name = /seafdav

seafile.conf

[fileserver]
port = 8082
max_upload_size = 102400
max_download_dir_size = 102400
max_indexing_threads = 2
fixed_block_size=2
web_token_expire_time=43200

hi @dofl how big is the file that you try to download? How long it takes until you get the error?

Hi @jobenvil. The upload is 6 GB. The file uploads completely, but then fails.

try with:

proxy_request_buffering off;      # you already have it
proxy_buffering off;                    # new one 

inside webdav block

I have these as well, but not for seafile webdav:

# WebDAV

client_body_temp_path   /media/sda/tmp/nginx_body_temp_path;
dav_methods             PUT DELETE MKCOL COPY MOVE;
#       dav_ext_methods         PROPFIND OPTIONS;
create_full_put_path    on;
dav_access              user:rw group:rw all:rw;
#       allow all;

you have to create the directory in order to save the body:/media/sda/tmp/nginx_body_temp_path;