Not possible to install mysql-server-wsrep-5.6 with salt

Bug #1662173 reported by Dmitry Kalashnik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mirantis OpenStack
Fix Committed
High
Dmitry Teselkin

Bug Description

There is an issue with mysql init.d script that redirects stdout of a process run in the background. This leads to subprocess.Popen process with file descriptor that was piped to a stream from child process existing after child process has exited with 0. Because it's state wasn't checked by parent (it tries to read from that file descriptor) we have one process hanged and another one in defunct state

How to reproduce:
#!/usr/bin/python

import os
import subprocess

args = [
    'apt-get', '-q', '-y',
    '-o', 'DPkg::Options::=--force-confold',
    '-o', 'DPkg::Options::=--force-confdef',
    'install', 'mysql-server-wsrep-5.6']

kwargs = {
    'shell': False,
    'env': {
        'LC_NUMERIC': 'C',
        'LC_ADDRESS': 'C',
        'DEBIAN_FRONTEND': 'noninteractive',
        'LC_MEASUREMENT': 'C',
        'LC_CTYPE': 'C',
        'UPSTART_JOB': 'salt-minion',
        'LC_PAPER': 'C',
        'PATH': '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin',
        'UCF_FORCE_CONFFOLD': '1',
        'APT_LISTCHANGES_FRONTEND': 'none',
        'LC_IDENTIFICATION': 'C',
        'TERM': 'linux',
        'LC_MESSAGES': 'C',
        'LC_MONETARY': 'C',
        'LC_COLLATE': 'C',
        'LC_TELEPHONE': 'C',
        'UPSTART_INSTANCE': '',
        'PWD': '/',
        'LC_NAME': 'C',
        'LC_TIME': 'C',
        'APT_LISTBUGS_FRONTEND': 'none',
    },
    'close_fds': True,
    'stdout': -1,
    'stderr': -1,
    'cwd': '/root',
    }

print('Creating process')
process = subprocess.Popen(args, **kwargs)

print('Communicating with process')
stdout, stderr = process.communicate(input=None)

Tags: non-release
Changed in mos:
assignee: nobody → Dmitry Teselkin (teselkin-d)
tags: added: non-release
Revision history for this message
Atsuko Ito (yottatsa) wrote :

Couldn't reproduce into clean docker image. Need more data.

Revision history for this message
Atsuko Ito (yottatsa) wrote :

I've reproduced it. Mistake both in Salt and init script.

Revision history for this message
Atsuko Ito (yottatsa) wrote :

1. Stderr should be closed in init-script or in mysqld_safe.
2. SaltStack should check for process death.

Revision history for this message
Fuel Devops McRobotson (fuel-devops-robot) wrote : Fix proposed to packages/trusty/mysql-wsrep-5.6 (9.0)

Fix proposed to branch: 9.0
Change author: Dmitry Teselkin <email address hidden>
Review: https://review.fuel-infra.org/31019

Changed in mos:
status: Confirmed → In Progress
Revision history for this message
Dmitry Teselkin (teselkin-d) wrote :
Changed in mos:
status: In Progress → Fix Committed
Revision history for this message
Ivan Suzdal (isuzdal) wrote :
Revision history for this message
Fuel Devops McRobotson (fuel-devops-robot) wrote : Change abandoned on packages/trusty/mysql-wsrep-5.6 (9.0)

Change abandoned by Dmitry Teselkin <email address hidden> on branch: 9.0
Review: https://review.fuel-infra.org/31019

Revision history for this message
Fuel Devops McRobotson (fuel-devops-robot) wrote :

Change abandoned by Dmitry Teselkin <email address hidden> on branch: 9.0
Review: https://review.fuel-infra.org/30445

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.