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
diff --git a/debian/changelog b/debian/changelog
index ba975fd..db28711 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
1mysql-8.0 (8.0.28-0ubuntu0.21.10.4) impish; urgency=medium
2
3 * d/mysql-server-8.0.postinst:
4 - Increase stop_server timeout so shutdowns that last up to 3 minutes do not
5 trigger apport (LP: #1899248)
6 - Create and add correct permissions to the mysql socket directory before
7 running mysqld post-update. (LP: #1964969)
8
9 -- Lena Voytek <lena.voytek@canonical.com> Mon, 14 Mar 2022 07:35:49 -0700
10
1mysql-8.0 (8.0.28-0ubuntu0.21.10.3) impish-security; urgency=medium11mysql-8.0 (8.0.28-0ubuntu0.21.10.3) impish-security; urgency=medium
212
3 * SECURITY UPDATE: Update to 8.0.28 to fix security issues13 * SECURITY UPDATE: Update to 8.0.28 to fix security issues
diff --git a/debian/mysql-server-8.0.postinst b/debian/mysql-server-8.0.postinst
index 05e2122..4aa0b80 100755
--- a/debian/mysql-server-8.0.postinst
+++ b/debian/mysql-server-8.0.postinst
@@ -40,18 +40,21 @@ start_server() {
40# Usage: stop_server <tmpdir>40# Usage: stop_server <tmpdir>
41# Params:41# Params:
42# tmpdir - Location of temporary pid-file42# tmpdir - Location of temporary pid-file
43# Returns:
44# 0 - Shutdown successful
45# 1 - Shutdown took longer than 3 minutes
43stop_server(){46stop_server(){
44 local tmpdir=$147 local tmpdir=$1
45 # Send kill signal48 # Send kill signal
46 server_pid=$(cat "$tmpdir/mysqld.pid")49 server_pid=$(cat "$tmpdir/mysqld.pid")
47 kill "$server_pid"50 kill "$server_pid"
4851
49 for i in $(seq 1 60); do52 for i in $(seq 1 180); do
50 sleep 0.1 # A full second is too long, but we need to give the server _some_ time.53 sleep 0.1 # A full second is too long, but we need to give the server _some_ time.
51 if ! $(ps $server_pid >/dev/null 2>&1); then54 if ! $(ps $server_pid >/dev/null 2>&1); then
52 return 055 return 0
53 fi56 fi
54 sleep 157 sleep 0.9
55 done58 done
56 # The server hasn't shut down in a timely manner59 # The server hasn't shut down in a timely manner
57 echo "Error: Unable to shut down server with process id $server_pid" >&260 echo "Error: Unable to shut down server with process id $server_pid" >&2
@@ -190,9 +193,9 @@ case "$1" in
190 # variants in Ubuntu.193 # variants in Ubuntu.
191 /usr/share/mysql-common/configure-symlinks install mysql "$mysql_cfgdir/mysql.cnf"194 /usr/share/mysql-common/configure-symlinks install mysql "$mysql_cfgdir/mysql.cnf"
192195
193 # Ensure the existence and right permissions for the database and196 # Ensure the existence and right permissions for the database, socket
194 # log files.197 # folder, and log files.
195 for d in $mysql_statedir $mysql_filesdir $mysql_keyringdir $mysql_logdir198 for d in $mysql_statedir $mysql_filesdir $mysql_keyringdir $mysql_logdir $mysql_rundir
196 do199 do
197 if [ ! -d "$d" -a ! -L "$d" ]; then mkdir "$d"; fi200 if [ ! -d "$d" -a ! -L "$d" ]; then mkdir "$d"; fi
198 chown -R mysql:mysql $d201 chown -R mysql:mysql $d

Subscribers

People subscribed via source and target branches