1

Background: I am running a cqpweb, a corpus query interface written in PHP and connected to a mysql database, on an Apache2 webserver under Ubuntu 18.04 LTS. The Ubuntu server was set up from scratch and there are currently no manual configurations to mysql or php.

cqpweb ran happily unless it started throwing out error messages like this one:

 A MySQL query did not run successfully!

 Original query: LOAD DATA LOCAL INFILE '/data2/cqpweb/cach/tab_dist_fycel9oplk' INTO TABLE `db_dist_g2f3ndxf40` FIELDS ESCAPED BY '' /* from User: knappen |
 Function: create_db() | 2019-Apr-25 11:23:01 */

 Error # 0:

This happened overnight. Similar queries definitely worked at Apr 24 17:55 (local time, Berlin timezone) and were broken at the time given in the error message.

Question: Was there some kind of automated update or upgrade that can cause this kind of behaviour.

Additional information:

php --version
PHP 7.2.17-0ubuntu0.18.04.1 (cli) (built: Apr 18 2019 14:12:38) ( NTS )

mysql --version
mysql  Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using  EditLine wrapper

Inspection of some relevant log files:

/var/log/dkpg.log: No entries between 2019-04-24 14:47:54 and 2019-04-26 06:26:23

/var/log/apt/history.log: No entries between 2019-04-24 14:47:54 and 2019-04-26 06:26:23

/var/log/unattended-upgrades/unattended-upgrades.log:

2019-04-25 06:24:53,776 INFO Initial blacklisted packages: 
2019-04-25 06:24:53,778 INFO Initial whitelisted packages: 
2019-04-25 06:24:53,778 INFO Starting unattended upgrades script
2019-04-25 06:24:53,778 INFO Allowed origins are: o=Ubuntu,a=bionic, o=Ubuntu,a=bionic-security, o=UbuntuESM,a=bionic
2019-04-25 06:24:57,138 INFO No packages found that can be upgraded unattended and no pending auto-removals

More findings:

Form /var/log/apache2/error.log:

[Thu Apr 25 06:25:03.544172 2019] [mpm_prefork:notice] [pid 1244] AH00171: Graceful restart requested, doing restart

This restart is due to a cron job executing the script /etc/cron.daily/apache2. So there could be a change affecting apache2 installed ealier on but becoming active overnight in the critical time interval.

Related question, excluding other potential resasons like size limitations: What are size limits for mysql on Ubuntu 18.04 and how can I increase them?

EDIT: Since there is a daily cron job restarting Apache2, here are some changes from history.log between 2019-04-24 06:25:00 and 2019-04-25 06:25:00

Start-Date: 2019-04-24  06:52:06
Commandline: /usr/bin/unattended-upgrade
Upgrade: distro-info-data:amd64 (0.37ubuntu0.3, 0.37ubuntu0.4)
End-Date: 2019-04-24  06:52:07

Start-Date: 2019-04-24  14:46:57
Commandline: apt-get upgrade
Requested-By: knappen (1000)
Upgrade: php7.2-common:amd64 (7.2.15-0ubuntu0.18.04.2, 7.2.17-0ubuntu0.18.04.1), php7.2-cli:amd64 (7.2.15-0ubuntu0.18.04.2, 7.2.17-0ubuntu0.18.04.1), ureadahead:amd64 (0.100.0-20, 0.100.0-21), linux-libc-dev:amd64 (4.15.0-47.50, 4.15.0-48.51), libsystemd0:amd64 (237-3ubuntu10.20, 237-3ubuntu10.21), php7.2-mysql:amd64 (7.2.15-0ubuntu0.18.04.2, 7.2.17-0ubuntu0.18.04.1), language-selector-common:amd64 (0.188.1, 0.188.2), udev:amd64 (237-3ubuntu10.20, 237-3ubuntu10.21), plymouth-theme-ubuntu-text:amd64 (0.9.3-1ubuntu7.18.04.1, 0.9.3-1ubuntu7.18.04.2), php7.2-json:amd64 (7.2.15-0ubuntu0.18.04.2, 7.2.17-0ubuntu0.18.04.1), php7.2-opcache:amd64 (7.2.15-0ubuntu0.18.04.2, 7.2.17-0ubuntu0.18.04.1), linux-signed-generic:amd64 (4.15.0.47.49, 4.15.0.48.50), libudev1:amd64 (237-3ubuntu10.20, 237-3ubuntu10.21), libplymouth4:amd64 (0.9.3-1ubuntu7.18.04.1, 0.9.3-1ubuntu7.18.04.2), python3-distupgrade:amd64 (1:18.04.30, 1:18.04.31), ubuntu-release-upgrader-core:amd64 (1:18.04.30, 1:18.04.31), systemd-sysv:amd64 (237-3ubuntu10.20, 237-3ubuntu10.21), php7.2-readline:amd64 (7.2.15-0ubuntu0.18.04.2, 7.2.17-0ubuntu0.18.04.1), libpam-systemd:amd64 (237-3ubuntu10.20, 237-3ubuntu10.21), systemd:amd64 (237-3ubuntu10.20, 237-3ubuntu10.21), libnss-systemd:amd64 (237-3ubuntu10.20, 237-3ubuntu10.21), plymouth:amd64 (0.9.3-1ubuntu7.18.04.1, 0.9.3-1ubuntu7.18.04.2), libapache2-mod-php7.2:amd64 (7.2.15-0ubuntu0.18.04.2, 7.2.17-0ubuntu0.18.04.1)
End-Date: 2019-04-24  14:47:54
  • By default, Apache does not install a cron job. Something you're running elsewhere might, but none of the Apache packages install a cronjob in a default installation. – Thomas Ward Apr 29 '19 at 13:36
  • @ThomasWard I do not remember having installed the cron job intentionally and I assume it present since the system was installed. I installed apache2 from the Ubuntu distribution and keep it up to date using apt.—Note that I do not blame the ever present cron job for the actual change in behaviour, it probably only activated it. – Sir Cornflakes Apr 29 '19 at 13:41

1 Answers1

0

With the help from Stefan Evert and Andrew Hardie on the cwb mailing list, the reason of the strange behaviour is found and the problem goes away by setting the following configuration in /etc/php/7.2/apache2/php.ini

; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysqli.allow_local_infile
mysqli.allow_local_infile = On

The default was silently changed in the transition from PHP 7.2.15 to PHP 7.2.17 on 18th April and pushed to the Ubuntu distribution.

More details and some cqpweb internal alternatives can be found in this post on the CWB mailing list

NOTE ADDED: Upcoming versions of PHP will throw an error with an informative error message on the described conditions, see PHP::Bug#77956