android icon indicating copy to clipboard operation
android copied to clipboard

Smaller chunk size on wi-fi

Open gjedeer opened this issue 6 years ago • 6 comments
trafficstars

Is your feature request related to a problem? Please describe.

In https://github.com/nextcloud/android/issues/1238 owncloud-android has introduced chunked upload with 10MB chunks for wi-fi and 1MB chunks on mobile. Whenever I'm on wi-fi, I get a lot of failed uploads, Nextcloud keeps retrying which puts load on the server, and as a result there are always 3-4 php processes running.

Some uploads don't complete for days, despite being retried all the time. I still have an upload from April 10 in the queue. It was a relatively small file of about 30 MB. In the same queue, 500MB files sometimes passed at 2nd or 3rd try.

Today I did a manual build, replacing CHUNK_SIZE_WIFI in android-library with 1MB and magically, all the files are uploaded correctly for the first time. The load on my server is under 1.0 for the first time in a long time.

Android app was usually showing "unconfigured server" (which, as I've found in source code, is just error 500). The errors I've been getting in my owncloud server were Stream from assembly node shorter than expected, got 0 bytes, expected 10240000, full error pasted below.

Describe the solution you'd like

If there was a checkbox to always use 1MB chunks, that would be very helpful.

Describe alternatives you've considered

I checked my server configuration but it seems the issue just comes from network being slow.

Additional context

Server error:

{
  "reqId": "ZinRJr75P4hDbYAGVxsW",
  "level": 4,
  "time": "2019-04-29T17:16:30+00:00",
  "remoteAddr": "192.168.xxx",
  "user": "user",
  "app": "webdav",
  "method": "MOVE",
  "url": "/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
  "message": {
    "Exception": "Sabre\\DAV\\Exception",
    "Message": "Stream from assembly node shorter than expected, got 0 bytes, expected 10240000",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/apps/dav/lib/Connector/Sabre/File.php",
        "line": 231,
        "function": "convertToSabreException",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          {
            "__class__": "Exception"
          }
        ]
      },
      {
        "file": "/var/www/apps/dav/lib/Connector/Sabre/Directory.php",
        "line": 156,
        "function": "put",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Tree.php",
        "line": 316,
        "function": "createFile",
        "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
        "type": "->",
        "args": [
          "VID_20190414_071922.mp4",
          null
        ]
      },
      {
        "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Tree.php",
        "line": 130,
        "function": "copyNode",
        "class": "Sabre\\DAV\\Tree",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\DAV\\Upload\\FutureFile"
          },
          {
            "__class__": "OCA\\DAV\\Connector\\Sabre\\Directory"
          },
          "VID_20190414_071922.mp4"
        ]
      },
      {
        "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Tree.php",
        "line": 161,
        "function": "copy",
        "class": "Sabre\\DAV\\Tree",
        "type": "->",
        "args": [
          "uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
          "files/user/InstantUpload/Camera/VID_20190414_071922.mp4"
        ]
      },
      {
        "file": "/var/www/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "line": 642,
        "function": "move",
        "class": "Sabre\\DAV\\Tree",
        "type": "->",
        "args": [
          "uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
          "files/user/InstantUpload/Camera/VID_20190414_071922.mp4"
        ]
      },
      {
        "function": "httpMove",
        "class": "Sabre\\DAV\\CorePlugin",
        "type": "->",
        "args": [
          {
            "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/var/www/3rdparty/sabre/event/lib/EventEmitterTrait.php",
        "line": 105,
        "function": "call_user_func_array",
        "args": [
          [
            {
              "__class__": "Sabre\\DAV\\CorePlugin"
            },
            "httpMove"
          ],
          [
            {
              "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        ]
      },
      {
        "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 479,
        "function": "emit",
        "class": "Sabre\\Event\\EventEmitter",
        "type": "->",
        "args": [
          "method:MOVE",
          [
            {
              "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        ]
      },
      {
        "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 254,
        "function": "invokeMethod",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          {
            "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/var/www/apps/dav/lib/Server.php",
        "line": 301,
        "function": "exec",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/apps/dav/appinfo/v2/remote.php",
        "line": 35,
        "function": "exec",
        "class": "OCA\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/remote.php",
        "line": 163,
        "args": [
          "/var/www/apps/dav/appinfo/v2/remote.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/apps/dav/lib/Connector/Sabre/File.php",
    "Line": 622,
    "Previous": {
      "Exception": "Exception",
      "Message": "Stream from assembly node shorter than expected, got 0 bytes, expected 10240000",
      "Code": 0,
      "Trace": [
        {
          "function": "stream_read",
          "class": "OCA\\DAV\\Upload\\AssemblyStream",
          "type": "->",
          "args": [
            8192
          ]
        },
        {
          "file": "/var/www/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php",
          "line": 91,
          "function": "fread",
          "args": [
            null,
            8192
          ]
        },
        {
          "file": "/var/www/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php",
          "line": 98,
          "function": "stream_read",
          "class": "Icewind\\Streams\\Wrapper",
          "type": "->",
          "args": [
            8192
          ]
        },
        {
          "function": "stream_read",
          "class": "Icewind\\Streams\\CallbackWrapper",
          "type": "->",
          "args": [
            8192
          ]
        },
        {
          "file": "/var/www/lib/private/Files/Storage/Local.php",
          "line": 467,
          "function": "file_put_contents",
          "args": [
            "/srv/owncloud-data/user/files/InstantUpload/Camera/VID_20190414_071922.mp4.ocTransferId1574916193.part",
            null
          ]
        },
        {
          "file": "/var/www/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 630,
          "function": "writeStream",
          "class": "OC\\Files\\Storage\\Local",
          "type": "->",
          "args": [
            "files/InstantUpload/Camera/VID_20190414_071922.mp4.ocTransferId1574916193.part",
            null,
            null
          ]
        },
        {
          "file": "/var/www/apps/dav/lib/Connector/Sabre/File.php",
          "line": 185,
          "function": "writeStream",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->",
          "args": [
            "files/InstantUpload/Camera/VID_20190414_071922.mp4.ocTransferId1574916193.part",
            null
          ]
        },
        {
          "file": "/var/www/apps/dav/lib/Connector/Sabre/Directory.php",
          "line": 156,
          "function": "put",
          "class": "OCA\\DAV\\Connector\\Sabre\\File",
          "type": "->",
          "args": [
            null
          ]
        },
        {
          "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Tree.php",
          "line": 316,
          "function": "createFile",
          "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
          "type": "->",
          "args": [
            "VID_20190414_071922.mp4",
            null
          ]
        },
        {
          "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Tree.php",
          "line": 130,
          "function": "copyNode",
          "class": "Sabre\\DAV\\Tree",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\DAV\\Upload\\FutureFile"
            },
            {
              "__class__": "OCA\\DAV\\Connector\\Sabre\\Directory"
            },
            "VID_20190414_071922.mp4"
          ]
        },
        {
          "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Tree.php",
          "line": 161,
          "function": "copy",
          "class": "Sabre\\DAV\\Tree",
          "type": "->",
          "args": [
            "uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
            "files/user/InstantUpload/Camera/VID_20190414_071922.mp4"
          ]
        },
        {
          "file": "/var/www/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
          "line": 642,
          "function": "move",
          "class": "Sabre\\DAV\\Tree",
          "type": "->",
          "args": [
            "uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
            "files/user/InstantUpload/Camera/VID_20190414_071922.mp4"
          ]
        },
        {
          "function": "httpMove",
          "class": "Sabre\\DAV\\CorePlugin",
          "type": "->",
          "args": [
            {
              "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        },
        {
          "file": "/var/www/3rdparty/sabre/event/lib/EventEmitterTrait.php",
          "line": 105,
          "function": "call_user_func_array",
          "args": [
            [
              {
                "__class__": "Sabre\\DAV\\CorePlugin"
              },
              "httpMove"
            ],
            [
              {
                "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
                "__class__": "Sabre\\HTTP\\Request"
              },
              {
                "__class__": "Sabre\\HTTP\\Response"
              }
            ]
          ]
        },
        {
          "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Server.php",
          "line": 479,
          "function": "emit",
          "class": "Sabre\\Event\\EventEmitter",
          "type": "->",
          "args": [
            "method:MOVE",
            [
              {
                "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
                "__class__": "Sabre\\HTTP\\Request"
              },
              {
                "__class__": "Sabre\\HTTP\\Response"
              }
            ]
          ]
        },
        {
          "file": "/var/www/3rdparty/sabre/dav/lib/DAV/Server.php",
          "line": 254,
          "function": "invokeMethod",
          "class": "Sabre\\DAV\\Server",
          "type": "->",
          "args": [
            {
              "absoluteUrl": "https://myinstance/remote.php/dav/uploads/user/15736891724f1e0e9d52ecdcc25e3b08/.file",
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        },
        {
          "file": "/var/www/apps/dav/lib/Server.php",
          "line": 301,
          "function": "exec",
          "class": "Sabre\\DAV\\Server",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/apps/dav/appinfo/v2/remote.php",
          "line": 35,
          "function": "exec",
          "class": "OCA\\DAV\\Server",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/remote.php",
          "line": 163,
          "args": [
            "/var/www/apps/dav/appinfo/v2/remote.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/apps/dav/lib/Upload/AssemblyStream.php",
      "Line": 123
    },
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (Android) ownCloud-android/3.6.0",
  "version": "15.0.7.0"
}

gjedeer avatar Apr 29 '19 17:04 gjedeer