Creating a new file from the web interface in an external SMB storage causes all external SMB storages to be unavailable
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
The attempt to create a file with the "Add file" button in a smb external storage folder causes an error. We get an alert "Unable to create new file from template".
After this, all SMB external storage on the instance are unavalaible ("Storage with mount id ## is not available" or "External storage not available: Storage unauthorized").
The SMB external storage go back after few minutes. And we can see the file was created anyway.
Steps to reproduce
- Mount SMB external storage for certains users
- In Web UI, go to folder inside smb external storage
- Click on plus button and choose "new text document"
Expected behavior
Just the possibility to create new files without crashing samba mounts.
Installation method
Manual installation
Operating system
Debian/Ubuntu
PHP engine version
PHP 7.4
Web server
Apache (supported)
Database engine version
MySQL
Is this bug present after an update or on a fresh install?
Updated to a major version (ex. 22.2.3 to 23.0.1)
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
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"brad.cheneraie",
"brad.lacheneraie.dna"
],
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"allow_local_remote_servers": true,
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "23.0.6.1",
"overwrite.cli.url": "https:\/\/brad.cheneraie",
"htaccess.RewriteBase": "\/",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"maintenance": false,
"share_folder": "\/PARTAGES RE\u00c7US",
"skeletondirectory": "\/var\/data\/brad\/default\/",
"default_language": "fr",
"force_language": "fr",
"default_locale": "fr_FR",
"force_locale": "fr_FR",
"default_phone_region": "FR",
"mail_smtpmode": "smtp",
"mail_sendmailmode": "smtp",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.distribued": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0
},
"ldapIgnoreNamingRules": false,
"ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
"simpleSignUpLink.shown": false,
"theme": "",
"loglevel": 2,
"app_install_overwrite": [
"keeweb"
],
"updater.release.channel": "stable",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "2526",
"enable_previews": false,
"activity_use_cached_mountpoints": true,
"updater.secret": "***REMOVED SENSITIVE VALUE***"
}
}
List of activated Apps
Enabled:
- accessibility: 1.9.0
- activity: 2.15.0
- bruteforcesettings: 2.4.0
- cfg_share_links: 2.0.0
- cloud_federation_api: 1.6.0
- comments: 1.13.0
- contactsinteraction: 1.4.0
- dav: 1.21.0
- federatedfilesharing: 1.13.0
- files: 1.18.0
- files_accesscontrol: 1.13.0
- files_external: 1.15.0
- files_pdfviewer: 2.4.0
- files_readmemd: 1.2.2
- files_rightclick: 1.2.0
- files_sharing: 1.15.0
- files_trashbin: 1.13.0
- files_versions: 1.16.0
- files_videoplayer: 1.12.0
- groupfolders: 11.1.5
- impersonate: 1.10.0
- login_notes: 1.0.4
- logreader: 2.8.0
- lookup_server_connector: 1.11.0
- notifications: 2.11.1
- notify_push: 0.4.0
- oauth2: 1.11.0
- onlyoffice: 7.4.2
- password_policy: 1.13.0
- privacy: 1.7.0
- provisioning_api: 1.13.0
- recommendations: 1.2.0
- settings: 1.5.0
- systemtags: 1.13.0
- tasks: 0.14.4
- text: 3.4.1
- theming: 1.14.0
- theming_customcss: 1.11.0
- twofactor_backupcodes: 1.12.0
- updatenotification: 1.13.0
- user_ldap: 1.13.1
- user_saml: 5.0.2
- viewer: 1.7.0
- workflowengine: 2.5.0
Disabled:
- admin_audit
- circles: 22.3.0
- dashboard: 7.0.0
- deck: 1.6.3
- encryption
- federation: 1.12.0
- files_fulltextsearch: 23.0.1
- firstrunwizard: 2.6.0
- fulltextsearch: 23.0.0
- fulltextsearch_elasticsearch: 23.0.0
- nextcloud_announcements: 1.6.0
- photos: 1.1.0
- serverinfo: 1.7.0
- sharebymail: 1.7.0
- spreed: 13.0.6
- support: 1.0.1
- survey_client: 1.5.0
- user_status: 1.0.1
- weather_status: 1.0.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
{"reqId":"3dVsMBpDXPbBKypgfUCM","level":3,"time":"2022-07-05T15:00:26+00:00","remoteAddr":"10.0.5.106","user":"simon.jacques","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files/api/v1/templates/create","message":"Error while getting file info","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0","version":"23.0.6.1","exception":{"Exception":"Icewind\\SMB\\Exception\\TimedOutException","Message":"/Equipe%20Encadrement/ASTREINTE/test06.md","Code":110,"Trace":[{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":75,"function":"fromMap","class":"Icewind\\SMB\\Exception\\Exception","type":"::"},{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":92,"function":"handleError","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":351,"function":"testResult","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php","line":305,"function":"getxattr","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php","line":43,"function":"getAttribute","class":"Icewind\\SMB\\Native\\NativeShare","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php","line":69,"function":"stat","class":"Icewind\\SMB\\Native\\NativeFileInfo","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php","line":114,"function":"getSize","class":"Icewind\\SMB\\Native\\NativeFileInfo","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":189,"function":"stat","class":"Icewind\\SMB\\Native\\NativeShare","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":561,"function":"getFileInfo","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":599,"function":"getMetaData","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php","line":447,"function":"getMetaData","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":599,"function":"getMetaData","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":599,"function":"getMetaData","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":117,"function":"getMetaData","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":155,"function":"getData","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":341,"function":"scanFile","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Updater.php","line":125,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":323,"function":"update","class":"OC\\Files\\Cache\\Updater","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1189,"function":"writeUpdate","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":575,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Node/Folder.php","line":200,"function":"touch","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Template/TemplateManager.php","line":162,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/nextcloud/apps/files/lib/Controller/TemplateController.php","line":57,"function":"createFromTemplate","class":"OC\\Files\\Template\\TemplateManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"create","class":"OCA\\Files\\Controller\\TemplateController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":62,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php","Line":44,"CustomMessage":"Error while getting file info"},"id":"62c4592406032"}
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the stack trace in apps/files_external/lib/Lib/Storage/SMB.php, especially getFileInfo, and follow the template creation path through apps/files/lib/Controller/TemplateController.php and lib/private/Files/Template/TemplateManager.php. Reproduce creating a text document in an SMB folder and inspect how the timeout affects availability; done means the file is created without making the instance's SMB storages unavailable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100