Cannot delete big files from external storage samba

I mounted an smb folder as external storage (with user credentials) in nextcloud.
Now inside this shared folder I can edit, share and upload files/folders.
But when I try to delete a file it says “error deleting file …” and does not delete the file. Only when I create it inside the shared folder with terminal (touch test.txt) or via nextcloud itself (+ new document) then I can delete it. But when I drag a file from windows file explorer into NC or create a file in windows explorer smb mount, then I can not delete those. But for all files permissions and ownerships are exactly the same.

When I try to delete a folder, it gives the same error, but does remove the folder (if there are files inside the folder it deletes those too).

Also accessing the smb share folder via windows file explorer everything works, including deleting files without errors.

UPDATE:
Deleting small files works: it gives the error and warning, but not the fatal log from below.
For big sizes it also gives the fatal log.

What I tried:
Setting permissions of shared folder to 777 recursively, did not work, so not a permissions issue right?

Below my log:
Fatal:

[webdav] Fatal: Icewind\SMB\Exception\Exception: Unknown error () for /img.jpg at <<closure>>

 0. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php line 35
    Icewind\SMB\Exception\Exception::unknown("/img.jpg", false)
 1. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php line 88
    Icewind\SMB\Exception\Exception::fromMap({NT_STATUS_LOGON ... "}, false, "/img.jpg")
 2. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php line 441
    Icewind\SMB\Wrapped\Parser->checkForError(["Try \"help\" t ... "], "/img.jpg")
 3. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php line 136
    Icewind\SMB\Wrapped\Share->parseOutput(["Try \"help\" t ... "], "/img.jpg")
 4. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php line 237
    Icewind\SMB\Wrapped\Share->simpleCommand("del", "/img.jpg")
 5. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php line 253
    Icewind\SMB\Wrapped\Share->del("/img.jpg", true)
 6. /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php line 410
    Icewind\SMB\Wrapped\Share->del("/img.jpg")
 7. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 267
    OCA\Files_External\Lib\Storage\SMB->unlink("/img.jpg")
 8. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/PermissionsMask.php line 108
    OC\Files\Storage\Wrapper\Wrapper->unlink("img.jpg")
 9. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 267
    OC\Files\Storage\Wrapper\PermissionsMask->unlink("img.jpg")
10. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php line 285
    OC\Files\Storage\Wrapper\Wrapper->unlink("img.jpg")
11. <<closure>>
    OC\Files\Storage\Wrapper\Availability->unlink("img.jpg")
12. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 194
    call_user_func([OC\Files\Storag ... "], "img.jpg")
13. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 99
    OCA\Files_Trashbin\Storage->doDelete("img.jpg", "unlink")
14. /var/www/html/nextcloud/apps/files_trashbin/lib/Trashbin.php line 336
    OCA\Files_Trashbin\Storage->unlink("img.jpg")
15. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php line 108
    OCA\Files_Trashbin\Trashbin::move2trash("Files/img.jpg")
16. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 103
    OCA\Files_Trashbin\Trash\LegacyTrashBackend->moveToTrash(OCA\Files_Trashb ... }}, "img.jpg")
17. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 192
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash(OCA\Files_Trashb ... }}, "img.jpg")
18. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 99
    OCA\Files_Trashbin\Storage->doDelete("img.jpg", "unlink")
19. /var/www/html/nextcloud/lib/private/Files/View.php line 1167
    OCA\Files_Trashbin\Storage->unlink("img.jpg")
20. /var/www/html/nextcloud/lib/private/Files/View.php line 724
    OC\Files\View->basicOperation("unlink", "/Files/img.jpg", ["delete"])
21. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 466
    OC\Files\View->unlink("/Files/img.jpg")
22. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 183
    OCA\DAV\Connector\Sabre\File->delete()
23. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 295
    Sabre\DAV\Tree->delete("files/tom/Files/img.jpg")
24. /var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
25. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 474
    Sabre\DAV\Server->emit("method:DELETE", [Sabre\HTTP\Requ ... }])
26. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 251
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
27. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 319
    Sabre\DAV\Server->start()
28. /var/www/html/nextcloud/apps/dav/lib/Server.php line 332
    Sabre\DAV\Server->exec()
29. /var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
30. /var/www/html/nextcloud/remote.php line 167
    require_once("/var/www/html/n ... p")

DELETE /nextcloud/remote.php/dav/files/tom/Files/img.jpg
from myIIP by tom at 2020-12-17T05:17:11+00:00

Warning:

[no app in context] Warning: OCP\Files\GenericFileException: Failed write steam to files_trashbin/files/img.jpg.d1608182230 at <<closure>>

 0. /var/www/html/nextcloud/lib/private/Files/Storage/Common.php line 626
    OC\Files\Storage\Local->writeStream("files_trashbin/ ... 0", null)
 1. /var/www/html/nextcloud/lib/private/Files/Storage/Local.php line 530
    OC\Files\Storage\Common->copyFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 2. /var/www/html/nextcloud/lib/private/Files/Storage/Common.php line 688
    OC\Files\Storage\Local->copyFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0", true)
 3. /var/www/html/nextcloud/lib/private/Files/Storage/Local.php line 554
    OC\Files\Storage\Common->moveFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 4. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 575
    OC\Files\Storage\Local->moveFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 5. /var/www/html/nextcloud/apps/files_trashbin/lib/Trashbin.php line 322
    OC\Files\Storage\Wrapper\Wrapper->moveFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 6. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php line 108
    OCA\Files_Trashbin\Trashbin::move2trash("Files/img.jpg")
 7. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 103
    OCA\Files_Trashbin\Trash\LegacyTrashBackend->moveToTrash(OCA\Files_Trashb ... }}, "img.jpg")
 8. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 192
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash(OCA\Files_Trashb ... }}, "img.jpg")
 9. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 99
    OCA\Files_Trashbin\Storage->doDelete("img.jpg", "unlink")
10. /var/www/html/nextcloud/lib/private/Files/View.php line 1167
    OCA\Files_Trashbin\Storage->unlink("img.jpg")
11. /var/www/html/nextcloud/lib/private/Files/View.php line 724
    OC\Files\View->basicOperation("unlink", "/Files/img.jpg", ["delete"])
12. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 466
    OC\Files\View->unlink("/Files/img.jpg")
13. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 183
    OCA\DAV\Connector\Sabre\File->delete()
14. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 295
    Sabre\DAV\Tree->delete("files/tom/Files/img.jpg")
15. /var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
16. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 474
    Sabre\DAV\Server->emit("method:DELETE", [Sabre\HTTP\Requ ... }])
17. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 251
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
18. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 319
    Sabre\DAV\Server->start()
19. /var/www/html/nextcloud/apps/dav/lib/Server.php line 332
    Sabre\DAV\Server->exec()
20. /var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
21. /var/www/html/nextcloud/remote.php line 167
    require_once("/var/www/html/n ... p")

DELETE /nextcloud/remote.php/dav/files/tom/Files/img.jpg
from myIIP by tom at 2020-12-17T05:17:11+00:00

Error:

[PHP] Error: Error: file_put_contents(/mnt/storage/data/tom/files_trashbin/files/img.jpg.d1608182230): failed to open stream: No such file or directory at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#559 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError(2, "file_put_conten ... y", "/var/www/html/n ... p", 559, {path: "files_tr ... l})
 1. /var/www/html/nextcloud/lib/private/Files/Storage/Local.php line 559
    file_put_contents("/mnt/storage/da ... 0", null)
 2. /var/www/html/nextcloud/lib/private/Files/Storage/Common.php line 626
    OC\Files\Storage\Local->writeStream("files_trashbin/ ... 0", null)
 3. /var/www/html/nextcloud/lib/private/Files/Storage/Local.php line 530
    OC\Files\Storage\Common->copyFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 4. /var/www/html/nextcloud/lib/private/Files/Storage/Common.php line 688
    OC\Files\Storage\Local->copyFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0", true)
 5. /var/www/html/nextcloud/lib/private/Files/Storage/Local.php line 554
    OC\Files\Storage\Common->moveFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 6. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 575
    OC\Files\Storage\Local->moveFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 7. /var/www/html/nextcloud/apps/files_trashbin/lib/Trashbin.php line 322
    OC\Files\Storage\Wrapper\Wrapper->moveFromStorage(OCA\Files_Trashb ... }}, "img.jpg", "files_trashbin/ ... 0")
 8. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php line 108
    OCA\Files_Trashbin\Trashbin::move2trash("Files/img.jpg")
 9. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 103
    OCA\Files_Trashbin\Trash\LegacyTrashBackend->moveToTrash(OCA\Files_Trashb ... }}, "img.jpg")
10. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 192
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash(OCA\Files_Trashb ... }}, "img.jpg")
11. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 99
    OCA\Files_Trashbin\Storage->doDelete("img.jpg", "unlink")
12. /var/www/html/nextcloud/lib/private/Files/View.php line 1167
    OCA\Files_Trashbin\Storage->unlink("img.jpg")
13. /var/www/html/nextcloud/lib/private/Files/View.php line 724
    OC\Files\View->basicOperation("unlink", "/Files/img.jpg", ["delete"])
14. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 466
    OC\Files\View->unlink("/Files/img.jpg")
15. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 183
    OCA\DAV\Connector\Sabre\File->delete()
16. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 295
    Sabre\DAV\Tree->delete("files/tom/Files/img.jpg")
17. /var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
18. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 474
    Sabre\DAV\Server->emit("method:DELETE", [Sabre\HTTP\Requ ... }])
19. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 251
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
20. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 319
    Sabre\DAV\Server->start()
21. /var/www/html/nextcloud/apps/dav/lib/Server.php line 332
    Sabre\DAV\Server->exec()
22. /var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
23. /var/www/html/nextcloud/remote.php line 167
    require_once("/var/www/html/n ... p")

DELETE /nextcloud/remote.php/dav/files/tom/Files/img.jpg
from myIIP by tom at 2020-12-17T05:17:11+00:00

Should I report this as a bug?

Apparently the www-data user had no permission for that nextcloud user’s folder, by which it could not “chunk” and therefore could not delete.
After giving right permission it works.

Hey, I’m having the same problem…
How would xou change the www-data users permissions?