Bug 245344 - www/nextcloud: 18.0.3: upgrade failure:
Summary: www/nextcloud: 18.0.3: upgrade failure:
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Bernard Spil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-04 10:25 UTC by O. Hartmann
Modified: 2020-05-12 20:49 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (brnrd)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2020-04-04 10:25:40 UTC
Running www/nextcloud 18.0.3 on recent CURRENT (FreeBSD 13.0-CURRENT #48 r359629: Sat Apr  4 09:46:08 CEST 2020 amd64) with databases/postgresql12-server as backend (ports tree at r530627) results in trouble upgrading an existent nextcloud installation via

# su -m www -c 'php ./occ upgrade'
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request. in /usr/local/www/nextcloud/lib/private/DB/Connection.php:68
Stack trace:
#0 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(420): OC\DB\Connection->connect()
#1 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(380): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(324): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(683): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /usr/local/www/nextcloud/lib/private/DB/Connection.php(155): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(195): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOPgSql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /usr/local/www/nextcloud/lib/private/DB/ConnectionFactory.php(159): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /usr/local/www/nextcloud/lib/private/Server.php(748): OC\DB\ConnectionFactory->getConnection('pgsql', Array)
#8 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#9 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OCP\\IDBConnecti...')
#10 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OCP\\IDBConnecti...')
#11 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#12 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('DatabaseConnect...')
#13 /usr/local/www/nextcloud/lib/private/Server.php(1664): OC\ServerContainer->query('DatabaseConnect...')
#14 /usr/local/www/nextcloud/lib/private/Server.php(421): OC\Server->getDatabaseConnection()
#15 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#16 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\Authenticati...')
#17 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(70): OC\ServerContainer->query('OC\\Authenticati...', true)
#18 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(100): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#19 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#20 /usr/local/www/nextcloud/lib/private/ServerContainer.php(150): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...', true)
#21 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(70): OC\ServerContainer->query('OC\\Authenticati...', true)
#22 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(100): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#23 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#24 /usr/local/www/nextcloud/lib/private/ServerContainer.php(150): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...', true)
#25 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OC\\Authenticati...')
#26 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#27 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\Authenticati...')
#28 /usr/local/www/nextcloud/lib/private/Server.php(433): OC\ServerContainer->query('OC\\Authenticati...')
#29 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#30 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\User\\Session')
#31 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OC\\User\\Session')
#32 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#33 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('UserSession')
#34 /usr/local/www/nextcloud/lib/private/Server.php(1540): OC\ServerContainer->query('UserSession')
#35 /usr/local/www/nextcloud/lib/private/Server.php(801): OC\Server->getUserSession()
#36 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#37 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\App\\AppManag...')
#38 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OC\\App\\AppManag...')
#39 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#40 /usr/local/www/nextcloud/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('AppManager')
#41 /usr/local/www/nextcloud/lib/private/Server.php(1835): OC\ServerContainer->query('AppManager')
#42 /usr/local/www/nextcloud/lib/private/legacy/app.php(347): OC\Server->getAppManager()
#43 /usr/local/www/nextcloud/lib/private/legacy/app.php(114): OC_App::getEnabledApps()
#44 /usr/local/www/nextcloud/lib/base.php(645): OC_App::loadApps(Array)
#45 /usr/local/www/nextcloud/lib/base.php(1089): OC::init()
#46 /usr/local/www/nextcloud/console.php(48): require_once('/usr/local/www/...')
#47 /usr/local/www/nextcloud/occ(11): require_once('/usr/local/www/...')
#48 {main}root@walhall:/usr/local/www/nextcloud
[...]

The file /usr/local/www/nextcloud/config/config.php looks like this one (cleared off of the secrets and passwords):

<?php

/** This is the bare minimum configuration for the bundled installer
  * to function properly.  
  */

$CONFIG = array (

  'instanceid' => 'XXXXXX',
  'passwordsalt' => 'XXXXXX',
  'secret' => 'XXXXXX',
  'trusted_domains' => 
  array (
    0 => 'myhost.do.main',
  ),
  'datadirectory' => '/pool/cloud/data',
  'overwrite.cli.url' => 'https://myhost.do.main./cloud',
  'dbtype' => 'pgsql',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_administrator',
  'dbpassword' => 'XXXX',
  'logtimezone' => 'UTC',
  'installed' => true,
  'loglevel' => 2,
  'maintenance' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'theme' => '',
  'appstoreenabled' => true,
  
/** The FreeBSD package separates apps into bundled apps and user-
  * installed apps. If this 'apps_paths' array is missing from
  * your config, your Nextcloud installation is broken 
  */
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/usr/local/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
    1 =>
    array (
      'path' => '/usr/local/www/nextcloud/apps-pkg',
      'url' => '/apps-pkg',
      'writable' => false,
    ),
  ),

// Log-files belong in the appropriate location
  'logfile' => '/var/log/nextcloud.log',

// Enable user caching when option is enabled
  'memcache.local' => '\OC\Memcache\APCu',
);
Comment 1 Bernard Spil freebsd_committer 2020-04-04 14:25:53 UTC
Looks like a database connectivity issue. Can you reach the database OK and is it usable? Is your environment setup proper for PHP+pgsql?
Comment 2 O. Hartmann 2020-04-04 15:29:22 UTC
DB server is locally and remotely (as far as configured) accessible. DB for nextcloud is accessible with the configured credentials via psql client from different hosts, including localhost.

Haven#t changed anything regarding php/pgsql so far.
Comment 3 O. Hartmann 2020-05-12 20:49:17 UTC
I figured out a very strange thing on recent CURRENT running PostgreSQL 12.2: I can not connect to the local postgresql server via tcp/tcp6 using a statement like:

psql -U oc_administrator -d nextcloud -h localhost|127.0.0.1|::1

psql: error: could not connect to server: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

(host is dual stack).

excerpt of sockstat:

postgres postgres   74299 4  tcp6   ::1:5432              *:*
postgres postgres   74299 5  tcp4   127.0.0.1:5432        *:*
postgres postgres   74299 6  tcp6   xxxx:xxxx::xxx:5432   *:*
postgres postgres   74299 7  tcp4   xxx.xxx.xxx.xxx:5432    *:*
postgres postgres   74299 8  stream /tmp/.s.PGSQL.5432

Command 

psql -U oc_administrator -d nextcloud  

(connecting to the local socket) works well.

The problem seems not nextcloud relatetd, but more a serious issue either with my setup (which worked well until I upgrade from PostgreSQL 11 to 12 and still working with other services of PostgreSQL).