Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[S3] fclose(): supplied resource is not a valid stream resource #28496

Closed
pierreozoux opened this issue Aug 18, 2021 · 11 comments · Fixed by #28505
Closed

[S3] fclose(): supplied resource is not a valid stream resource #28496

pierreozoux opened this issue Aug 18, 2021 · 11 comments · Fixed by #28505
Assignees
Labels
1. to develop Accepted and waiting to be taken care of bug feature: object storage

Comments

@pierreozoux
Copy link
Member

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Looks similar to #23373

Steps to reproduce

  1. Go to web UI
  2. upload a somehow big file, bigger than the chunk size that is by default 10MB, so for instance 100MB

Expected behaviour

There shouldn't be errors in the nextcloud.log

Actual behaviour

There are errors.

Server configuration

Nextcloud version: 20.0.11

Where did you install Nextcloud from: docker

Are you using external storage, if yes which one: ceph rados gateway / s3 compatible

Are you using encryption: no

Logs

Nextcloud log (data/nextcloud.log)

Nextcloud log
{
   "reqId":"RgbGEzK8IUMkYzSQjFY3",
   "level":3,
   "time":"2021-08-18T07:42:32+00:00",
   "remoteAddr":"49.12.19.171",
   "user":"admin",
   "app":"PHP",
   "method":"PUT",
   "url":"/remote.php/dav/uploads/admin/web-file-upload-761e5de13b91cf0c4ab6f34b6164e593-1629271135519/754974720",
   "message":{
      "Exception":"Error",
      "Message":"fclose(): supplied resource is not a valid stream resource at /usr/src/nextcloud/3rdparty/icewind/streams/src/Wrapper.php#132",
      "Code":0,
      "Trace":[
         {
            "function":"onError",
            "class":"OC\\Log\\ErrorHandler",
            "type":"::",
            "args":[
               2,
               "fclose(): supplied resource is not a valid stream resource",
               "/usr/src/nextcloud/3rdparty/icewind/streams/src/Wrapper.php",
               132,
               [
                  
               ]
            ]
         },
         {
            "file":"/usr/src/nextcloud/3rdparty/icewind/streams/src/Wrapper.php",
            "line":132,
            "function":"fclose",
            "args":[
               null
            ]
         },
         {
            "file":"/usr/src/nextcloud/3rdparty/icewind/streams/src/CallbackWrapper.php",
            "line":119,
            "function":"stream_close",
            "class":"Icewind\\Streams\\Wrapper",
            "type":"->",
            "args":[
               
            ]
         },
         {
            "function":"stream_close",
            "class":"Icewind\\Streams\\CallbackWrapper",
            "type":"->",
            "args":[
               
            ]
         },
         {
            "file":"/usr/src/nextcloud/3rdparty/guzzlehttp/psr7/src/Stream.php",
            "line":105,
            "function":"fclose",
            "args":[
               null
            ]
         },
         {
            "file":"/usr/src/nextcloud/3rdparty/guzzlehttp/psr7/src/Stream.php",
            "line":73,
            "function":"close",
            "class":"GuzzleHttp\\Psr7\\Stream",
            "type":"->",
            "args":[
               
            ]
         },
         {
            "function":"__destruct",
            "class":"GuzzleHttp\\Psr7\\Stream",
            "type":"->",
            "args":[
               
            ]
         }
      ],
      "File":"/usr/src/nextcloud/lib/private/Log/ErrorHandler.php",
      "Line":91,
      "CustomMessage":"--"
   },
   "userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:92.0) Gecko/20100101 Firefox/92.0",
   "version":"20.0.11.1"
}
@pierreozoux pierreozoux added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 18, 2021
@juliusknorr
Copy link
Member

Should have been fixed by icewind1991/Streams@93bce47 but seems the package didn't get an update on the stable branches in the 3rdparty repo.

@juliusknorr juliusknorr added 1. to develop Accepted and waiting to be taken care of feature: object storage and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 18, 2021
@juliusknorr
Copy link
Member

@skjnldsv @ChristophWurst Should we maybe also setup dependabot for minor updates in the stable branches of https://github.com/nextcloud/3rdparty ?

@ChristophWurst
Copy link
Member

Sure :)

@PVince81
Copy link
Member

PVince81 commented Oct 8, 2021

also just reproduced on 21.0.5 with minio object store docker:

  1. run docker run -p 9000:9000 minio/minio server /data
  2. setup NC
  3. edit config.php and set the settings like below
'objectstore' =>
	array (
		'class' => 'OC\\Files\\ObjectStore\\S3',
		'arguments' =>
		array (
			'bucket' => 'nextcloud-dev',
			'key' => 'minioadmin',
			'secret' => 'minioadmin',
			'hostname' => 'localhost',
			'port' => '9000',
			'use_ssl' => false,
			'use_path_style' => true,
		),
	),
  1. login as admin/admin

I see this in the log:

{"reqId":"my0o14wBcN7ZTAbx1Obt","level":3,"time":"2021-10-08T07:27:49+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"/index.php/apps/files/","message":{"Exception":"Error","Message":"fclose(): supplied resource is not a valid stream resource at /srv/www/htdocs/server/3rdparty/icewind/streams/src/Wrapper.php#96","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"fclose(): supplied resource is not a valid stream resource","/srv/www/htdocs/server/3rdparty/icewind/streams/src/Wrapper.php",96,[]]},{"file":"/srv/www/htdocs/server/3rdparty/icewind/streams/src/Wrapper.php","line":96,"function":"fclose","args":[null]},{"file":"/srv/www/htdocs/server/3rdparty/icewind/streams/src/CallbackWrapper.php","line":117,"function":"stream_close","class":"Icewind\\Streams\\Wrapper","type":"->","args":[]},{"function":"stream_close","class":"Icewind\\Streams\\CallbackWrapper","type":"->","args":[]},{"file":"/srv/www/htdocs/server/3rdparty/guzzlehttp/psr7/src/Stream.php","line":108,"function":"fclose","args":[null]},{"file":"/srv/www/htdocs/server/3rdparty/guzzlehttp/psr7/src/Stream.php","line":74,"function":"close","class":"GuzzleHttp\\Psr7\\Stream","type":"->","args":[]},{"function":"__destruct","class":"GuzzleHttp\\Psr7\\Stream","type":"->","args":[]}],"File":"/srv/www/htdocs/server/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36","version":"21.0.5.1"}

@PVince81
Copy link
Member

PVince81 commented Oct 8, 2021

@PVince81
Copy link
Member

PVince81 commented Oct 18, 2021

Reponing to track backport to stable20 because I need somewhere to put the long checklist:

@kesselb
Copy link
Contributor

kesselb commented Oct 22, 2021

PHP Warning: Declaration of OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext($name = NULL) in /drone/src/lib/private/Files/Stream/Encryption.php on line 0

PHP Warning: Declaration of OC\Files\Stream\Encryption::wrapSource($source, $context, $protocol, $class, $mode = 'r+') should be compatible with Icewind\Streams\WrapperHandler::wrapSource($source, $context = Array, $protocol = NULL, $class = NULL, $mode = 'r+') in /drone/src/lib/private/Files/Stream/Encryption.php on line 0

Found the above error messages in a backport for stable20: https://drone.nextcloud.com/nextcloud/server/11030/14/5

The update from 0.7.1 to 0.7.2 for stable21 required some code changes: #24533

Unfortunately the 0.7.2 update and the code changes were not backported to stable20.

@PVince81
Copy link
Member

backports are merged, closing

@PVince81 PVince81 reopened this Oct 25, 2021
@PVince81
Copy link
Member

PHP Warning: Declaration of OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext($name = NULL) in /drone/src/lib/private/Files/Stream/Encryption.php on line 0

PHP Warning: Declaration of OC\Files\Stream\Encryption::wrapSource($source, $context, $protocol, $class, $mode = 'r+') should be compatible with Icewind\Streams\WrapperHandler::wrapSource($source, $context = Array, $protocol = NULL, $class = NULL, $mode = 'r+') in /drone/src/lib/private/Files/Stream/Encryption.php on line 0

Found the above error messages in a backport for stable20: https://drone.nextcloud.com/nextcloud/server/11030/14/5

The update from 0.7.1 to 0.7.2 for stable21 required some code changes: #24533

Unfortunately the 0.7.2 update and the code changes were not backported to stable20.

oops, I'll recheck

@PVince81
Copy link
Member

PR here for the missing code changes for stable20: #29426

@skjnldsv
Copy link
Member

PR here for the missing code changes for stable20: #29426

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug feature: object storage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants