nextcloud / previewgenerator

Nextcloud app to do preview generation in the background.
https://apps.nextcloud.com/apps/previewgenerator
GNU Affero General Public License v3.0
459 stars 57 forks source link

An unhandled exception has been thrown: TypeError: strlen() expects parameter 1 to be string, bool given in /home/nginx/nextcloud/apps/files_external/3rdparty/icewind/smb/src/StringBuffer.php:48 #235

Closed toad33 closed 3 years ago

toad33 commented 3 years ago

Hello all,

I am facing an issue with the preview apps and i need som help Nextcloud version (eg, 20.0.5): 20.0.9.1 Operating system and version (eg, Ubuntu 20.04): CentOS 7.7 Apache or nginx version (eg, Apache 2.4.25): nginx v1.16.1 PHP version (eg, 7.4): 7.4.19

It is a freh install of nextcloud in this environement, one external share using SMB where data (photos) are stored (~150GB), I need to create all the preview.

When I use the follwoing command line (sudo -u nginx php occ preview:generate-all -vvv) the process fail after ~5hours with the following error output on the command line:

An unhandled exception has been thrown:
TypeError: strlen() expects parameter 1 to be string, bool given in /home/nginx/nextcloud/apps/files_external/3rdparty/icewind/smb/src/StringBuffer.php:48
Stack trace:
#0 /home/nginx/nextcloud/apps/files_external/3rdparty/icewind/smb/src/StringBuffer.php(48): strlen()
#1 /home/nginx/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeReadStream.php(57): Icewind\SMB\StringBuffer->read()
#2 [internal function]: Icewind\SMB\Native\NativeReadStream->stream_read()
#3 /home/nginx/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php(55): fread()
#4 /home/nginx/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php(96): Icewind\Streams\Wrapper->stream_read()
#5 [internal function]: Icewind\Streams\CallbackWrapper->stream_read()
#6 /home/nginx/nextcloud/lib/private/Preview/ProviderV2.php(92): file_put_contents()
#7 /home/nginx/nextcloud/lib/private/Preview/Image.php(50): OC\Preview\ProviderV2->getLocalFile()
#8 /home/nginx/nextcloud/lib/private/Preview/GeneratorHelper.php(63): OC\Preview\Image->getThumbnail()
#9 /home/nginx/nextcloud/lib/private/Preview/Generator.php(244): OC\Preview\GeneratorHelper->getThumbnail()
#10 /home/nginx/nextcloud/lib/private/Preview/Generator.php(140): OC\Preview\Generator->getMaxPreview()
#11 /home/nginx/nextcloud/lib/private/PreviewManager.php(205): OC\Preview\Generator->generatePreviews()
#12 /home/nginx/nextcloud/apps/previewgenerator/lib/Command/Generate.php(203): OC\PreviewManager->generatePreviews()
#13 /home/nginx/nextcloud/apps/previewgenerator/lib/Command/Generate.php(174): OCA\PreviewGenerator\Command\Generate->parseFile()
#14 /home/nginx/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#15 /home/nginx/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#16 /home/nginx/nextcloud/apps/previewgenerator/lib/Command/Generate.php(155): OCA\PreviewGenerator\Command\Generate->parseFolder()
#17 /home/nginx/nextcloud/apps/previewgenerator/lib/Command/Generate.php(123): OCA\PreviewGenerator\Command\Generate->generateUserPreviews()
#18 /home/nginx/nextcloud/lib/private/User/Manager.php(571): OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}()
#19 /home/nginx/nextcloud/apps/previewgenerator/lib/Command/Generate.php(124): OC\User\Manager->callForSeenUsers()
#20 /home/nginx/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\PreviewGenerator\Command\Generate->execute()
#21 /home/nginx/nextcloud/3rdparty/symfony/console/Application.php(1000): Symfony\Component\Console\Command\Command->run()
#22 /home/nginx/nextcloud/3rdparty/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand()
#23 /home/nginx/nextcloud/3rdparty/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun()
#24 /home/nginx/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#25 /home/nginx/nextcloud/console.php(100): OC\Console\Application->run()
#26 /home/nginx/nextcloud/occ(11): require_once('/home/nginx/nex...')
#27 {main}

Steps to replicate it:

Launch the command to generate all preview: sudo -u nginx php occ preview:generate-all -vvv

I set DEBUG level on log located in /var/log/nextcloud/nextcloud.log, here the last line when the error occurs

{"reqId":"FZcwVikZ6o3Yx2bnnbxK","level":0,"time":"May 16, 2021 14:13:01","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"OC_Image->fixOrientation() Orientation: 6","userAgent":"--","version":"20.0.9.1"}
{"reqId":"FZcwVikZ6o3Yx2bnnbxK","level":0,"time":"May 16, 2021 14:14:08","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"OC_Image->fixOrientation() Orientation: 6","userAgent":"--","version":"20.0.9.1"}
{"reqId":"FZcwVikZ6o3Yx2bnnbxK","level":0,"time":"May 16, 2021 14:15:18","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"OC_Image->fixOrientation() Orientation: 6","userAgent":"--","version":"20.0.9.1"}
{"reqId":"FZcwVikZ6o3Yx2bnnbxK","level":0,"time":"May 16, 2021 14:16:05","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"OC_Image->fixOrientation() Orientation: 6","userAgent":"--","version":"20.0.9.1"}

In addition, I did a modification following this https://blog.nuvotex.de/nextcloud-smb-stringbuffer/ as I encoutered first an issue regarding data size calculation (https://github.com/nextcloud/server/issues/26457 )

Any idea to find the root cause ? thank you !