[NC21]Stream_copy_to_stream ERROR

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): Nextcloud 21.0.1
Operating system and version (eg, Ubuntu 20.04): Debian 9
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.25
PHP version (eg, 7.4): Php 7.3

The issue you are facing:

In the logging section i can see a lot of this error:
"Error: stream_copy_to_stream(): Icewind\SMB\Native\NativeReadStream::stream_read - read 12397 bytes more data than requested (20589 read, 8192 max) - excess data will be lost at /var/www/nextcloud/lib/private/AppFramework/Http/Output.php#61

When i try to open a document shared withh external folder i can see this error and concurrently the file present “Document upload failing”.

Is this the first time you’ve seen this error? (Y/N): Y (only after the recent upgrade to NC21)

Steps to replicate it:

  1. Open a file with Collabora Online
  2. The file present “Document Upload Failed”
  3. I can see in registration the error written on top

The output of your Nextcloud log in Admin > Logging:

Error: stream_copy_to_stream(): Icewind\SMB\Native\NativeReadStream::stream_read - read 12397 bytes more data than requested (20589 read, 8192 max) - excess data will be lost at /var/www/nextcloud/lib/private/AppFramework/Http/Output.php#61

OTHER
I have tried to find the solution seeking in Native folder of Icewind (external app) and i think is a problem with the CHUNK SIZE:

    > public function stream_read($count) {
    > 		// php reads 8192 bytes at once
    > 		// however due to network latency etc, it's faster to read in larger chunks
    > 		// and buffer the result
    > 		if (!parent::stream_eof() && $this->readBuffer->remaining() < $count) {
    > 			$chunk = parent::stream_read(self::CHUNK_SIZE);
    > 			if ($chunk === false) {
    > 				return false;
    > 			}
    > 			$this->readBuffer->push($chunk);
    > 		}
    > 
    > 		$result = $this->readBuffer->read($count);
    > 
    > 		$read = strlen($result);
    > 		$this->pos += $read;
    > 
    > 		return $result;

I didn't understand how to resolve because it appears only after the upgrade of NextCloud 21.

Thank you at all

Hi, I have the same issue. And we aren’t alone!

There is a workaround (confirm works) linked there:

Good luck!