nextcloud / nextcloud/maps

[Bug]: cron job fails with `files_external` connection problems

Open
#1,022 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
JavaScript
Stars
598
Forks
113
PR merge metrics
No merged PRs in 30d

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Cron www-data@server /usr/bin/php -f /mnt/data/var/www/nextcloud/cron.php
fails with the following error message:

Icewind\SMB\Exception\ConnectionException in /mnt/data/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/RawConnection.php:82
Stack trace:
#0 /mnt/data/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php(109): Icewind\SMB\Wrapped\RawConnection->connect()
#1 /mnt/data/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php(347): Icewind\SMB\Wrapped\Share->getConnection()
#2 /mnt/data/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php(467): Icewind\SMB\Wrapped\Share->read()
#3 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/LocalTempFileTrait.php(65): OCA\Files_External\Lib\Storage\SMB->fopen()
#4 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/LocalTempFileTrait.php(48): OC\Files\Storage\Common->toTmpFile()
#5 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Common.php(273): OC\Files\Storage\Common->getCachedFile()
#6 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Common->getLocalFile()
#7 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php(374): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#8 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Wrapper\Availability->getLocalFile()
#9 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#10 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Jail.php(377): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#11 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Wrapper\Jail->getLocalFile()
#12 /mnt/data/var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php(444): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#13 /mnt/data/var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php(341): OCA\Maps\Service\PhotofilesService->getExif()
#14 /mnt/data/var/www/nextcloud/apps/maps/lib/BackgroundJob/AddPhotoJob.php(67): OCA\Maps\Service\PhotofilesService->addPhotoNow()
#15 /mnt/data/var/www/nextcloud/lib/public/BackgroundJob/Job.php(78): OCA\Maps\BackgroundJob\AddPhotoJob->run()
#16 /mnt/data/var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(58): OCP\BackgroundJob\Job->start()
#17 /mnt/data/var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(48): OCP\BackgroundJob\QueuedJob->start()
#18 /mnt/data/var/www/nextcloud/cron.php(152): OCP\BackgroundJob\QueuedJob->execute()
#19 {main}

Next TypeError: get_resource_type(): Argument #1 ($resource) must be of type resource, null given in /mnt/data/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php:110
Stack trace:
#0 /mnt/data/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php(110): get_resource_type()
#1 /mnt/data/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/RawConnection.php(247): Icewind\SMB\Wrapped\Connection->close()
#2 /mnt/data/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php(347): Icewind\SMB\Wrapped\RawConnection->__destruct()
#3 /mnt/data/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php(467): Icewind\SMB\Wrapped\Share->read()
#4 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/LocalTempFileTrait.php(65): OCA\Files_External\Lib\Storage\SMB->fopen()
#5 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/LocalTempFileTrait.php(48): OC\Files\Storage\Common->toTmpFile()
#6 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Common.php(273): OC\Files\Storage\Common->getCachedFile()
#7 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Common->getLocalFile()
#8 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php(374): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#9 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Wrapper\Availability->getLocalFile()
#10 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#11 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Jail.php(377): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#12 /mnt/data/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(367): OC\Files\Storage\Wrapper\Jail->getLocalFile()
#13 /mnt/data/var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php(444): OC\Files\Storage\Wrapper\Wrapper->getLocalFile()
#14 /mnt/data/var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php(341): OCA\Maps\Service\PhotofilesService->getExif()
#15 /mnt/data/var/www/nextcloud/apps/maps/lib/BackgroundJob/AddPhotoJob.php(67): OCA\Maps\Service\PhotofilesService->addPhotoNow()
#16 /mnt/data/var/www/nextcloud/lib/public/BackgroundJob/Job.php(78): OCA\Maps\BackgroundJob\AddPhotoJob->run()
#17 /mnt/data/var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(58): OCP\BackgroundJob\Job->start()
#18 /mnt/data/var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(48): OCP\BackgroundJob\QueuedJob->start()
#19 /mnt/data/var/www/nextcloud/cron.php(152): OCP\BackgroundJob\QueuedJob->execute()
#20 {main}
Steps to reproduce
  1. Run cron job, every 15 minutes the error appears.
Expected behavior

Cron job doesn't fail

Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install of the server?

None

Is this bug present after an update or on a fresh install of the app?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
sudo -u www-data php occ config:list system
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***\/nextcloud",
        "htaccess.RewriteBase": "\/nextcloud",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.4.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "filelocking.enabled": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "loglevel": 0,
        "app_install_overwrite": [
            "bookmarks_fulltextsearch",
            "quickaccesssorting",
            "ocr",
            "files_downloadactivity",
            "checksum",
            "audioplayer_editor",
            "epubreader",
            "gpxmotion",
            "previewgenerator",
            "audioplayer_sonos",
            "camerarawpreviews",
            "apporder",
            "duplicatefinder",
            "files_markdown",
            "talked",
            "video_converter",
            "extract",
            "files_ebookreader",
            "talk_simple_poll"
        ],
        "loglevel:9": "",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "preview_max_memory": 4096,
        "preview_max_filesize_image": 256,
        "jpeg_quality": "60",
        "enabledPreviewProviders": [
            "OC\\Preview\\Image",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\Movie",
            "OC\\Preview\\MKV",
            "OC\\Preview\\MP4",
            "OC\\Preview\\AVI"
        ],
        "theme": "",
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "default_phone_region": "DE",
        "trashbin_retention_obligation": "90, auto",
        "memories.exiftool": "***REMOVED SENSITIVE VALUE***\/apps\/memories\/exiftool-bin\/exiftool-amd64-glibc",
        "memories.ffmpeg_path": "\/usr\/bin\/ffmpeg",
        "memories.ffprobe_path": "\/usr\/bin\/ffprobe",
        "memories.transcoder": "***REMOVED SENSITIVE VALUE***\/apps\/memories\/exiftool-bin\/go-vod-amd64",
        "memories.no_transcode": false,
        "memories.qsv": true,
        "memories.gis_type": 1
    }
}
List of activated Apps
sudo -u www-data php occ app:list
Enabled:
  - activity: 2.17.0
  - admin_audit: 1.15.0
  - audioplayer: 3.3.1
  - bookmarks: 12.1.0
  - bruteforcesettings: 2.5.0
  - calendar: 4.3.1
  - camerarawpreviews: 0.8.1
  - checksum: 1.2.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - cloud_py_api: 0.1.6
  - comments: 1.15.0
  - contacts: 5.2.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - deck: 1.8.3
  - event_update_notification: 2.0.0
  - external: 5.0.2
  - extract: 1.3.5
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_downloadactivity: 1.16.0
  - files_external: 1.17.0
  - files_fulltextsearch: 25.0.0
  - files_fulltextsearch_tesseract: 25.0.0
  - files_markdown: 2.3.6
  - files_mindmap: 0.0.27
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - flow_notifications: 1.5.0
  - fulltextsearch: 25.0.0
  - fulltextsearch_elasticsearch: 25.0.0
  - gpxmotion: 0.1.0
  - gpxpod: 5.0.6
  - groupfolders: 13.1.1
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - mail: 2.2.5
  - maps: 1.0.2
  - mediadc: 0.3.5
  - memories: 4.12.5
  - metadata: 0.17.0
  - music: 1.8.1
  - news: 21.1.0
  - nextcloud_announcements: 1.14.0
  - notes: 4.7.2
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - passwords: 2023.3.21
  - photos: 2.0.1
  - previewgenerator: 5.2.1
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - quickaccesssorting: 1.1.4
  - recommendations: 1.4.0
  - related_resources: 1.0.4
  - richdocuments: 7.1.2
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - side_menu: 3.7.1
  - spreed: 15.0.5
  - support: 1.8.0
  - survey_client: 1.13.0
  - suspicious_login: 4.3.0
  - systemtags: 1.15.0
  - talked: 0.5.0
  - tasks: 0.14.5
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - video_converter: 1.0.5
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - welcome: 1.0.8
  - workflow_ocr: 1.25.4
  - workflowengine: 2.7.0
Disabled:
  - bookmarks_fulltextsearch: 1.2.0
  - encryption
  - epubreader: 1.4.7
  - facerecognition: 0.9.5
  - files_antivirus: 4.0.3
  - ransomware_protection: 1.14.0
  - recognize: 3.7.0
  - twofactor_totp
  - user_ldap: 1.10.2
Nextcloud Signing status
No errors have been found.
Nextcloud Logs

No response

Browser Console

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/maps/lib/BackgroundJob/AddPhotoJob.php and apps/maps/lib/Service/PhotofilesService.php from the cron stack trace, then follow the external-storage calls into apps/files_external/lib/Lib/Storage/SMB.php and the Icewind SMB connection files. Reproduce the cron run with the reported setup and trace the connection failure. Done means cron completes without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.