Nextcloud SSL shutdown while in init

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:

Server:
Nextcloud version (eg, 12.0.2): 18.0.3
Operating system and version (eg, Ubuntu 17.04): Arch Linux
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41 (Unix)
PHP version (eg, 7.1): 7.4.4

Client:
Client version: 2.6.4git
Qt: 5.14.1
OpenSSL: 1.1.1e 17 Mar 2020

The issue you are facing:
On multiple computers, with multiple accounts on my instance, synchronization using the Nextcloud desktop client fails reproducible. When opening the client, discovery of remote changes starts as expected, but after a couple of seconds the synchronization fails with

An error occurred while opening a folder Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init

This happens each time the synchronisation starts, only very small syncs finish without an error. When running the nextcloud client from the command line, I get:

[OCC::AbstractNetworkJob::start 	OCC::LsColJob created for "https://<domain>/nextcloud" + "/path/to/folder" "OCC::DiscoverySingleDirectoryJob"
[OCC::WebFlowCredentials::slotFinished 	request finished
[OCC::AbstractNetworkJob::slotFinished 	QNetworkReply::UnknownNetworkError "Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init" QVariant(Invalid)
[OCC::WebFlowCredentials::stillValid 	QNetworkReply::UnknownNetworkError
[OCC::WebFlowCredentials::stillValid 	"Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init"
[OCC::LsColJob::finished 	LSCOL of QUrl("https://<domain>/nextcloud/remote.php/dav/files/<user>/path/to/folder") FINISHED WITH STATUS "UnknownNetworkError Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init"
[OCC::DiscoverySingleDirectoryJob::lsJobFinishedWithErrorSlot 	LSCOL job error "Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init" 0 QNetworkReply::UnknownNetworkError
[csync_ftw 	opendir failed for path/to/folder - errno 5
[OCC::SyncEngine::handleSyncError 	ERROR during  csync_update :  "An error occurred while opening a folder Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init"
[OCC::ActivityWidget::addError 	Item  "Nextcloud"  retrieved resulted in  "An error occurred while opening a folder Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init"
[OCC::ActivityListModel::addErrorToActivityList 	Error successfully added to the notification list:  "An error occurred while opening a folder Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init"
[OCC::SyncJournalDb::close 	Closing DB "/home/<user>/Nextcloud/._sync_e0241355035a.db"
[OCC::SyncEngine::finalize 	CSync run took  5427 ms
[OCC::Folder::slotSyncFinished 	Client version 2.6.4git  Qt 5.14.1  SSL  OpenSSL 1.1.1e  17 Mar 2020
[OCC::Folder::slotSyncFinished 	SyncEngine finished with ERROR
[OCC::Folder::showSyncResultPopup 	Folder sync result:  2
[OCC::Folder::slotSyncFinished 	the last 1 syncs failed
[OCC::ownCloudGui::slotSyncStateChange 	Sync state changed for folder  "https://<domain>/nextcloud/remote.php/dav/files/<user>/" :  "Error"
[OCC::FolderMan::slotFolderSyncFinished 	<========== Sync finished for folder [Nextcloud] of account [<user>@<domain>] with remote [https://<domain>/nextcloud/remote.php/dav/files/<user>/]

However, no error messages appear together with failing synchronisation. Only when starting the client, the messages below appear once. I have already updated and restarted both the client and the server machines, and also completely logged out and logged back in in the desktop client.

Any ideas how to further debug the issue? Is this a client issue, or a server issue?

The output of your Nextcloud log in Admin > Logging:

  Debug    core               OC\AppFramework\Middleware\Security\Exceptions\NotLoggedInException: Current user is not logged in at .../Middleware/Security/SecurityMiddleware.php line 142                                        2020-03-29T13:41:04+00:00 
                                                                                                                                                                                                                                                             
                              0. lib/private/AppFramework/Middleware/MiddlewareDispatcher.php line 97                                                                                                                                                        
                                 OC\AppFramework\Middleware\Security\SecurityMiddleware->beforeController(                                                                                                                                                   
                                                                                                                                                                                                                                                             
                                 )                                                                                                                                                                                                                           
                              1. lib/private/AppFramework/Http/Dispatcher.php line 97                                                                                                                                                                        
                                 OC\AppFramework\Middleware\MiddlewareDispatcher->beforeController(                                                                                                                                                          
                                                                                                                                                                                                                                                             
                                 )                                                                                                                                                                                                                           
                              2. lib/private/AppFramework/App.php line 125                                                                                                                                                                                   
                                 OC\AppFramework\Http\Dispatcher->dispatch(                                                                                                                                                                                  
                                                                                                                                                                                                                                                             
                                 )                                                                                                                                                                                                                           
                              3. lib/private/AppFramework/Routing/RouteActionHandler.php line 47                                                                                                                                                             
                                 OC\AppFramework\App::main(                                                                                                                                                                                                  
                                                                                                                                                                                                                                                             
                                 )                                                                                                                                                                                                                           
                              4. <<closure>>                                                                                                                                                                                                                 
                                 OC\AppFramework\Routing\RouteActionHandler->__invoke(                                                                                                                                                                       
                                                                                                                                                                                                                                                             
                                 )                                                                                                                                                                                                                           
                              5. lib/private/Route/Router.php line 299                                                                                                                                                                                       
                                 call_user_func(                                                                                                                                                                                                             
                                                                                                                                                                                                                                                             
                                 )                                                                                                                                                                                                                           
                              6. ocs/v1.php line 82                                                                                                                                                                                                          
                                 OC\Route\Router->match(                                                                                                                                                                                                     
                                                                                                                                                                                                                                                             
                                 )                                                                                                                                                                                                                           
                              7. ocs/v2.php line 24                                                                                                                                                                                                          
                                 require_once("\/usr\/share\/webapps\/nextcloud\/ocs\/v1.php")                                                                                                                                                               

  Error    PHP                implode(): Invalid arguments passed at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#69                                                                                          2020-03-29T13:41:04+00:00 

  Error    PHP                array_map(): Expected parameter 2 to be an array, null given at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#69                                                                 2020-03-29T13:41:04+00:00 

  Error    PHP                implode(): Invalid arguments passed at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#60                                                                                          2020-03-29T13:41:04+00:00 

  Error    PHP                array_map(): Expected parameter 2 to be an array, null given at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#58                                                                 2020-03-29T13:41:04+00:00 

  Error    PHP                Undefined index: args at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#58                                                                                                        2020-03-29T13:41:04+00:00 

  Error    PHP                implode(): Invalid arguments passed at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#69                                                                                          2020-03-29T13:41:04+00:00 

  Error    PHP                array_map(): Expected parameter 2 to be an array, null given at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#69                                                                 2020-03-29T13:41:04+00:00 

  Error    PHP                implode(): Invalid arguments passed at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#60                                                                                          2020-03-29T13:41:04+00:00 

  Error    PHP                array_map(): Expected parameter 2 to be an array, null given at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#58                                                                 2020-03-29T13:41:04+00:00 

  Error    PHP                Undefined index: args at /usr/share/webapps/nextcloud/apps/logreader/lib/Log/Formatter.php#58                                                                                                        2020-03-29T13:41:04+00:00 

  Debug    no app in context  Deprecated event type for {"[object] (OCP\SabrePluginEvent)":{"*statusCode":200,"*message":"","*server":{"[object] (OCA\DAV\Connector\Sabre\Server)":{"tree":"[object]                               2020-03-29T13:41:04+00:00 
                              (OCA\DAV\Connector\Sabre\ObjectTree)","*baseUri":"/nextcloud/remote.php/webdav/","httpResponse":"[object] (Sabre\HTTP\Response)","httpRequest":"[object] (Sabre\HTTP\Request)","sapi":"[object]                                
                              (Sabre\HTTP\Sapi)","*plugins":[],"transactionType":null,"protectedProperties":{"...":"Over 20 items, aborting                                                                                                                  
                              normalization"},"debugExceptions":false,"resourceTypeMapping":[],"enablePropfindDepthInfinity":true,"xml":"[object] (Sabre\DAV\Xml\Service)","*listeners":{"...":"Over 20 items, aborting                                      
                              normalization"},"*logger":null}},"Symfony\Contracts\EventDispatcher\EventpropagationStopped":false}}: null

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '...',
  'passwordsalt' => '...',
  'secret' => '...',
  'trusted_domains' => 
  array (
    0 => '...',
    1 => '...',
    2 => '...',
  ),
  'datadirectory' => '/usr/share/webapps/nextcloud/data',
  'overwrite.cli.url' => '...',
  'dbtype' => 'mysql',
  'version' => '18.0.3.0',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => '...',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => '...',
  'mail_domain' => '...',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '...',
  'mail_smtpport' => '587',
  'mail_smtpname' => '...',
  'mail_smtppassword' => '...',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/usr/share/webapps/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/usr/share/webapps/nextcloud/apps2',
      'url' => '/apps2',
      'writable' => true,
    ),
  ),
  'loglevel' => 0,
  'maintenance' => false,
  'updater.release.channel' => 'stable',
  'theme' => '',
);

The output of your Apache/nginx/system log in /var/log/____:
Lots of successfull PROPFIND messages until the error occurs in access_log:

<ip> - <user> [29/Mar/2020:15:48:39 +0200] "PROPFIND /nextcloud/remote.php/dav/files/<user>/path/to/folder/ HTTP/1.1" 207 3067

No error messages in error_log.

Same here. I have no idea, why this error happens

Can you share what versions you are using, compared to mine above? Maybe we can figure out what we have in common…

For the record: I downloaded a large chunk of data from my Nextcloud instance over the webpage. This worked successfully without any SSL errors, both over a fast connection (short download) and a slow connection (long download).

So you downgraded your client version from 2.6.4 to 2.6.3?

Yes.
2.6.4 - > error 140E0197
downgrade to 2.6.3 - > test with new, mod an del files, no error, full funcional
for test upgrade to 2.6.4 - > error 140E0197
downgrade to 2.6.3 - > test with new, mod an del files, no error, full funcional

Okay, thanks :slight_smile: This points towards a client issue. I will try downgrading as well :slight_smile:

I tried downgrading to 2.6.3, 2.6.2, 2.6.1 and 2.6.0 with no luck. So it is not directly a problem of the nextcloud client. Maybe with some of its dependencies.

@eisente: Did you do anything else besides uninstalling and reinstalling the old version? Did you delete your user data or log out and log in again?

Downgrading the client didnt solve the problem for me, but rolling back the update of the openssl-package on my server did. It received the update to 1.1.1.e-1 today. Downgrading it to 1.1.1.d-2 fixed it reproducible. Please note that this are version numbers of the Arch Linux package.

1 Like

@user9812378 No, I only used the client setup with uninstall before install. I tested downgrade down to 2.5.3 and all version are functional but not 2.6.4.

1 Like

Okay, then it should have worked for me. Strange. I’ll check and downgrade the dependencies of the nextcloud desktop app tomorrow individually.

@wiesel: I’ll try that as well, my server is Arch Linux as well, and I should still have openssl 1.1.1.d-2 in my pacman cache :slight_smile: Thanks a lot for the hint. However, if it really is a server issue, why does the download trough the webinterface as well as other webservices work as expected? That would be a strange issue…

The only explanation is that you didn’t try enough to get the error as it doesn’t occur on every connection that is made to the server. :smiley:

Same here: Nextcloud worked just fine for me when everything was in sync, I noticed the error when I tried to add an account with ~4,5Gb on 5000 files to a fresh OS installation. The client didnt even pass the “scan” in the beginning of the sync where it determines what to download from the server. Maybe the location of the server (LAN/WAN) affects this as well. I had no errors for my off-site Nextcloud so far, though I don’t know which version of openssl Hetzner is running on their webservers.

Edit: Wait, there may be another explanation: do the big browsers use the openssl-lib or their own ssl implementations?

Good point: In Arch Linux, Firefox does not depend on openssl, while nextcloud-client does. So I’m first going to downgrade openssl on the client to version 1.1.1.d-2 to rule out a client issue. If that doesn’t help, I’m going to downgrade openssl on the server as well. As both systems are Arch Linux, this shouldn’t take much time.

I don’t think it depends on the location of the server, though, as I both tested with the server through the LAN as well as the WAN connection trough a cellular network.

Quick follow-up: I tried with the following combinations of openssl and nextcloud-client:

  • openssl v1.1.1.d-2 and nextcloud-client v2.6.3
  • openssl v1.1.1.d-2 and nextcloud-client v2.6.1
  • openssl v1.1.1.d-1 and nextcloud-client v2.6.0

None of them worked. All three of these are valid combinations that have worked in the past on my system. Therefore I think, one can more or less rule out a client issue, while it could still be a client issue in combination with the server.

I’ll try downgrading the test server next.

Did you restart your webserver (apache/nginx) after changing the openssl-package on the server? Had to do this as well, seems like the webserver keeps a cached version of the lib in the RAM.

What I have done so far was downgrading the openssl library on the client, not on the server. After downgrading the client didn’t help, I went on with downgrading the server. I checked the loaded versions of the openssl library using /proc/*/maps before and after the downgrade to confirm that apache switched to the old one after restarting.

With openssl v1.1.1.d-2 on the server, it now works with any version of openssl and nextcloud-client on the client, even the most recent ones (openssl-1.1.1.f-1 and nextcloud-client-2.6.4-1).

This is happening to me too. All of sudden the error just popped out of nowhere. I have not done anything on the server and a few hours ago it was still working… I also downgraded client (windows 10) to 6.4.3 but still having the error. I thought it was a particular file, removed the file but now the error is " An error occurred while opening a folder Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init.

I really need to get this fixed. No idea what went wrong.

I had this problem too. NC 17.0.5 and NC-Client (macOS) 2.6.4.
After a downgrade to NC V. 2.6.3 still the same error, than suddenly started working.

Someone already posted a new issue on github for that? Couldn’t find anything there.

Hi, have you tried downgrading the openssl library on your server as I described in my previous posts? This fixed the issue for me, at least until an upstream fix is implemented. Downgrading the client or the openssl library on the client didn’t help, though.