Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 692998 - www-apps/nextcloud-16.0.{3,4} crashes dev-db/mariadb: PHP message: PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused in
Summary: www-apps/nextcloud-16.0.{3,4} crashes dev-db/mariadb: PHP message: PHP Fatal ...
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-28 07:54 UTC by Michael Mair-Keimberger (iamnr3)
Modified: 2019-08-29 07:42 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
error from phpmyadmin (error.log,4.22 KB, text/plain)
2019-08-28 07:54 UTC, Michael Mair-Keimberger (iamnr3)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Mair-Keimberger (iamnr3) 2019-08-28 07:54:11 UTC
Created attachment 588408 [details]
error from phpmyadmin

Hi,

Since a few days I have troubles with a stable system which was running basically only nextcloud and a few other simple sites with nginx.

Whenever i open my nextcloud homepage, the mysql server crashes and i need to restart it. On my nextcloud installation i only got following error:
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.


In the logfiles i get following error:
PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused in /var/www/xxx/htdocs/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /var/www/xxx/htdocs/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(448): OC\DB\Connection->connect()
#1 /var/www/xxx/htdocs/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(410): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/xxx/htdocs/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(354): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/xxx/htdocs/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(710): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/xxx/htdocs/nextcloud/lib/private/DB/Connection.p




However, i don't think this is a problem with nextcloud per se but rather with mysql/mariadb.

It looks like this problem happen on the 07 August, because in my database i've lost all data from 07 August and since i haven't rebooted the system i got the problem only recently (it looks like the database entries weren't committed since then)

From genlop:
     Tue Aug  6 08:20:50 2019 >>> dev-db/mysql-connector-c-6.1.11-r2
     Tue Aug  6 08:20:53 2019 >>> app-emulation/qemu-guest-agent-4.0.0
     Tue Aug  6 08:20:57 2019 >>> dev-util/cmake-3.14.6
     Tue Aug  6 08:21:01 2019 >>> sys-apps/man-pages-5.01
     Tue Aug  6 08:21:04 2019 >>> sys-apps/busybox-1.30.1
     Wed Aug  7 12:43:53 2019 >>> dev-libs/yajl-2.1.0-r2
     Wed Aug  7 12:43:59 2019 >>> dev-ruby/yajl-ruby-1.3.1

Since i lost all data from 07 Aug, the mysql-connector-c could be the reason? However, i cannot go back to r1 as it's not available anymore. I've also tried to install the newer unstable version but got file collisions with dev-db/mariadb.

Right now everything is update to date. I've also removed every obsolete packages (emerge -ac) and rebooted the system multiple times. I've also rebuild mariadb and all it's dependencies too.
phpmyadmin (for managing mysql/mariadb) also also works as intended but as soon as i open the nextcloud database it crashes too.. (but not always): 
I've attached the error from phpmyadmin as file.



emerge --info:
Portage 2.3.69 (python 3.6.5-final-0, default/linux/amd64/17.1, gcc-8.3.0, glibc-2.29-r2, 4.19.52-gentoo x86_64)
=================================================================
System uname: Linux-4.19.52-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700_CPU_@_3.40GHz-with-gentoo-2.6
KiB Mem:     8162364 total,   6074496 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository gentoo: Tue, 27 Aug 2019 23:00:01 +0000
Head commit of repository gentoo: 2c7bdc17799ac9bc164ff4ec92f7105f3a9d6cad
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://192.168.2.1/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: yes

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=broadwell"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.1/ext-active/ /etc/php/apache2-php7.2/ext-active/ /etc/php/apache2-php7.3/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cgi-php7.3/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/php/cli-php7.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=broadwell"
DISTDIR="/mnt/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=3 -g --binpkg-changed-deps=y --binpkg-respect-use=y"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j3"
PKGDIR="/mnt/packages"
PORTAGE_BINHOST="http://10.0.2.20:8080/vs4"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 berkdb bzip2 cli crypt cxx dri fortran gdbm iconv ipv6 ldap libtirpc mmx multilib ncurses nls nptl openmp pam pcre readline seccomp split-usr sse sse2 ssl tcpd unicode xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-1 php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="qxl" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Bernard Cafarelli gentoo-dev 2019-08-28 20:19:44 UTC
On the nextcloud side, I have 16.0.4 running on my stable x86 server (and 16.0.3 previously) with mariadb currently at 10.2.22-r1 - and no issues at login or later here.

Rebuilding php may be worth a try (just a blind guess though), I leave other suggestions to the mysql-bugs@ folks
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2019-08-28 20:29:31 UTC
This is not a problem within Nextcloud or Gentoo PHP/MySQL packages. This is a user problem:

You do not mention the PHP version you are using. Assuming you are using supported PHP version (anything starting with 7.x) you will use mysqlnd.

You also don't mention if you are using dev-db/mysql or dev-db/mariadb.

Because you mentioned your server crashed it's possible that your database is marked as crashed, too. This will prevent access.

Anyway, you need to debug:

1) Make sure your database server is up&running.

2) Try to connect using mysql cli tool and run a simple query against your nextcloud database.
Comment 3 Michael Mair-Keimberger (iamnr3) 2019-08-29 07:42:38 UTC
(In reply to Thomas Deutschmann from comment #2)
> This is not a problem within Nextcloud or Gentoo PHP/MySQL packages. This is
> a user problem:
> 
> You do not mention the PHP version you are using. Assuming you are using
> supported PHP version (anything starting with 7.x) you will use mysqlnd.
> 
> You also don't mention if you are using dev-db/mysql or dev-db/mariadb.
> 
> Because you mentioned your server crashed it's possible that your database
> is marked as crashed, too. This will prevent access.
> 
> Anyway, you need to debug:
> 
> 1) Make sure your database server is up&running.
> 
> 2) Try to connect using mysql cli tool and run a simple query against your
> nextcloud database.

Sorry if my bug wasn't clear enough. I don't use mysql, only virtual/mysql which pulls dev-db/mariadb in my case. 
Regarding php:
vs4 ~ # eselect php show cli
php7.2
vs4 ~ # eselect php show fpm
php7.2

Also, my server (the host) never crashed, only the mariadb server instance crashs and also only when i trying to access the nextcloud database (either directly via the nextcloud homepage, or via phpmyadmin - haven't tested via cli). I have another database which i can access and browse without problems.
However i also lost data in my working database (data is lost since 07 Aug) so i assumed the problem happen while updating a package which belongs to mariadb or mysql.

Also from dmesg:
[ 2974.628390] mysqld[11304]: segfault at 7f2a78021000 ip 00007f2a9384e57a sp 00007f2a901a5098 error 4 in libc-2.29.so[7f2a93703000+159000]
[ 2974.628394] Code: 82 ec fe ff ff 0f 18 8e 00 01 00 00 0f 18 8e 40 01 00 00 0f 18 8e 80 01 00 00 0f 18 8e c0 01 00 00 c5 fe 6f 06 c5 fe 6f 4e 20 <c5> fe 6f 56 40 c5 fe 6f 5e 60 48 81 c6 80 00 00 00 48 81 ea 80 00
[ 5340.044624] mysqld[11895]: segfault at 7f239c021000 ip 00007f23b98dd571 sp 00007f23b813fd38 error 4 in libc-2.29.so[7f23b9792000+159000]
[ 5340.044628] Code: c3 4c 8d 14 17 4c 39 d6 0f 82 ec fe ff ff 0f 18 8e 00 01 00 00 0f 18 8e 40 01 00 00 0f 18 8e 80 01 00 00 0f 18 8e c0 01 00 00 <c5> fe 6f 06 c5 fe 6f 4e 20 c5 fe 6f 56 40 c5 fe 6f 5e 60 48 81 c6

Regarding Debug:
The database is up and running right now (i've disabled nextcloud for now)

Access to the database works (via phpmyadmin and cli). However only as long as i don't access the nextcloud database. - which would crash the mariadb server (not the host).


Anyway, i'm not sure what exactly caused the problem, it might be a update or anything else. I thought it might be because of a update which is why i've open this bug, however i guess it's quite difficult to find out...

What i will do is to remove and create a new database or try to restore the database from a backup.

I will close the bug as cantfix