Merge ~lvoytek/ubuntu/+source/mysql-8.0:mysql-lp1899248-increase-shutdown-timeout-sru-impish into ubuntu/+source/mysql-8.0:ubuntu/impish-devel

Proposed by Lena Voytek
Status: Merged
Merged at revision: fb6e67012d97d7628f418e482a01ee321072220d
Proposed branch: ~lvoytek/ubuntu/+source/mysql-8.0:mysql-lp1899248-increase-shutdown-timeout-sru-impish
Merge into: ubuntu/+source/mysql-8.0:ubuntu/impish-devel
Diff against target: 59 lines (+18/-5)
2 files modified
debian/changelog (+10/-0)
debian/mysql-server-8.0.postinst (+8/-5)
Reviewer Review Type Date Requested Status
Bryce Harrington (community) Approve
Utkarsh Gupta (community) Needs Information
Canonical Server Pending
Canonical Server Core Reviewers Pending
Review via email: mp+416904@code.launchpad.net

Description of the change

The increase of the timer to 3 minutes is based on the shudown times seen in LP #1899248 and its duplicates. The average shutdown time seen here is 1:31, with a maximum reasonable shutdown time of 2:42.
The secondary wait has been reduced from 1 second to .9 seconds to actually match the 3 minute timeout and help with debugging.

ppa:lvoytek/mysql-8.0-increase-shutdown-timeout-sru-impish

Steps to test:

# lxc launch images:ubuntu/impish test-failure-impish
# lxc exec test-failure-impish bash

# apt update && apt dist-upgrade -y

# apt install -y software-properties-common

- This ppa contains a shutdown timeout of 0, causing the error to be reproduced every time
# add-apt-repository ppa:lvoytek/mysql-autofail-install-impish

# apt install -y mysql-server

- A shutdown error will show up in the terminal:

mysqld is running as pid 2674
Error: Unable to shut down server with process id 2674
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1

- After the initial install mysqlx errors will also show up in the error log
# grep mysqlx /var/log/mysql/error.log

2022-03-15T17:16:12.930832Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2022-03-15T17:16:12.930905Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'

# exit

# lxc launch images:ubuntu/impish test-success-impish
# lxc exec test-success-impish bash

# apt update && apt dist-upgrade -y

# apt install -y software-properties-common

# add-apt-repository ppa:lvoytek/mysql-8.0-increase-shutdown-timeout-sru-impish

# apt install -y mysql-server

- mysql will install successfully without producing any shutdown errors
- After the initial install confirm no mysqlx errors show up in the error log
# grep mysqlx /var/log/mysql/error.log

2022-03-15T17:18:40.595713Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2022-03-15T17:18:43.216120Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-03-15T17:18:45.530306Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Bug #1964969 is a great one to point to for the mysqlx socket issue. Are you able to edit the description of that bug? If so, please update the description with description and analysis like was mentioned on yesterday's MP.

Revision history for this message
Lena Voytek (lvoytek) wrote :

Sure thing, I can update the bug description to describe the rationale, process, and where it was released in Jammy

Revision history for this message
Utkarsh Gupta (utkarsh) :
review: Needs Information
Revision history for this message
Bryce Harrington (bryce) wrote :

@utkarsh the .9 sec sleep is addressed in the description. In my own opinion it would be acceptable to keep as 1 sec, but I also have no argument against changing it to 0.9, so IMHO either 1.0 or 0.9 is fine. Like Lena says, a benefit to 0.9 is that from a user perspective it makes the software operate more closely to what's documented, which to me seems a sufficient rationale for this approach.

[Don't forget to be careful about consuming the canonical-server review slot, as it bumps the MP off our review page...]

Revision history for this message
Bryce Harrington (bryce) wrote :

This LGTM, same review commentary as MP #416826.

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

-rw-r--r-- 1 bryce bryce 1972 Mar 30 17:23 ../mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.changes
../mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.changes
Vcs-Git: https://git.launchpad.net/~bryce/ubuntu/+source/mysql-8.0
Vcs-Git-Commit: fb6e67012d97d7628f418e482a01ee321072220d
Vcs-Git-Ref: refs/heads/mysql-lp1899248-increase-shutdown-timeout-sru-impish

 fixup_changes dsc ../mysql-8.0_8.0.28-0ubuntu0.21.10.4.dsc ../mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.changes
 fixup_changes buildinfo ../mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.buildinfo ../mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.changes
 signfile changes ../mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.changes A661100B3DAC1D4F2CAD8A54E603B2578FB8F0FB

Checking signature on .changes
gpg: ../mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.changes: Valid signature from E603B2578FB8F0FB
Checking signature on .dsc
gpg: ../mysql-8.0_8.0.28-0ubuntu0.21.10.4.dsc: Valid signature from E603B2578FB8F0FB
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading mysql-8.0_8.0.28-0ubuntu0.21.10.4.dsc: done.
  Uploading mysql-8.0_8.0.28-0ubuntu0.21.10.4.debian.tar.xz: done.
  Uploading mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.buildinfo: done.
  Uploading mysql-8.0_8.0.28-0ubuntu0.21.10.4_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index ba975fd..db28711 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,13 @@
6+mysql-8.0 (8.0.28-0ubuntu0.21.10.4) impish; urgency=medium
7+
8+ * d/mysql-server-8.0.postinst:
9+ - Increase stop_server timeout so shutdowns that last up to 3 minutes do not
10+ trigger apport (LP: #1899248)
11+ - Create and add correct permissions to the mysql socket directory before
12+ running mysqld post-update. (LP: #1964969)
13+
14+ -- Lena Voytek <lena.voytek@canonical.com> Mon, 14 Mar 2022 07:35:49 -0700
15+
16 mysql-8.0 (8.0.28-0ubuntu0.21.10.3) impish-security; urgency=medium
17
18 * SECURITY UPDATE: Update to 8.0.28 to fix security issues
19diff --git a/debian/mysql-server-8.0.postinst b/debian/mysql-server-8.0.postinst
20index 05e2122..4aa0b80 100755
21--- a/debian/mysql-server-8.0.postinst
22+++ b/debian/mysql-server-8.0.postinst
23@@ -40,18 +40,21 @@ start_server() {
24 # Usage: stop_server <tmpdir>
25 # Params:
26 # tmpdir - Location of temporary pid-file
27+# Returns:
28+# 0 - Shutdown successful
29+# 1 - Shutdown took longer than 3 minutes
30 stop_server(){
31 local tmpdir=$1
32 # Send kill signal
33 server_pid=$(cat "$tmpdir/mysqld.pid")
34 kill "$server_pid"
35
36- for i in $(seq 1 60); do
37+ for i in $(seq 1 180); do
38 sleep 0.1 # A full second is too long, but we need to give the server _some_ time.
39 if ! $(ps $server_pid >/dev/null 2>&1); then
40 return 0
41 fi
42- sleep 1
43+ sleep 0.9
44 done
45 # The server hasn't shut down in a timely manner
46 echo "Error: Unable to shut down server with process id $server_pid" >&2
47@@ -190,9 +193,9 @@ case "$1" in
48 # variants in Ubuntu.
49 /usr/share/mysql-common/configure-symlinks install mysql "$mysql_cfgdir/mysql.cnf"
50
51- # Ensure the existence and right permissions for the database and
52- # log files.
53- for d in $mysql_statedir $mysql_filesdir $mysql_keyringdir $mysql_logdir
54+ # Ensure the existence and right permissions for the database, socket
55+ # folder, and log files.
56+ for d in $mysql_statedir $mysql_filesdir $mysql_keyringdir $mysql_logdir $mysql_rundir
57 do
58 if [ ! -d "$d" -a ! -L "$d" ]; then mkdir "$d"; fi
59 chown -R mysql:mysql $d

Subscribers

People subscribed via source and target branches