NetBSD Problem Report #48271
From Wolfgang.Stukenbrock@nagler-company.com Fri Oct 4 09:28:30 2013
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 4D92A70F1A
for <gnats-bugs@gnats.NetBSD.org>; Fri, 4 Oct 2013 09:28:30 +0000 (UTC)
Message-Id: <20131004092821.12B6F123B93@test-s0.nagler-company.com>
Date: Fri, 4 Oct 2013 11:28:21 +0200 (CEST)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: mysqld (5.5) startup fails during boot if console login is started
X-Send-Pr-Version: 3.95
>Number: 48271
>Category: pkg
>Synopsis: mysqld (5.5) startup fails during boot if console login is started
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: schmonz
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 04 09:30:00 +0000 2013
>Closed-Date: Fri Dec 05 17:27:32 +0000 2014
>Last-Modified: Fri Dec 05 17:27:32 +0000 2014
>Originator: Dr. Wolfgang Stukenbrock
>Release: NetBSD 6.1
>Organization:
Dr. Nagler & Company GmbH
>Environment:
System: NetBSD test-s0 5.1.2 NetBSD 5.1.2 (NSW-WS) #3: Fri Dec 21 15:15:43 CET 2012 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
Mysql server is monitored by a shell script called mysqld_safe that wil try to restart the server
if it terminates in an unexpected way.
This scripts writes messages on stdout.
But after the getty is started on /dev/console, stdout of this script has been revoked and
any write will fail. When mysqld_safe tries to write, SIGPIPE is triggerd.
SIGPIPE is not ingnored, so default action is taken that will immedialy kill the process.
>How-To-Repeat:
Setup mysql 5.5 server on a NetBSD 6.1 system and boot it. The server will not come up during boot.
>Fix:
There are two possible ways to fix this.
1. ignore SIGPIPE in mysqld_safe like other signals too
Change the line "trap '' 1 2 3 15" into "trap '' 1 2 3 13 15" in mysqld_safe to fix this.
2. ignore SIGPIPE in the rc-file and do not change mysqld_safe.
Add "trap '' 13" in front of calling mysqld_safe in function mysqld_start().
I'm not shure if this must be done in a sub-shell to avoid side effects in the startup code or not.
If a subshell must be used to ignore SIGPIPE, then "(" and ")" must be placed around the
new trap-statement and the call of the main program in background.
In order to keep the semantic with the last background command in the shell the following code
may be used:
( trap '' 13; exec ${command} --user=${mysqld_user} .... ) &
>Release-Note:
>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/48271: mysqld (5.5) startup fails during boot if console
login is started
Date: Wed, 9 Oct 2013 04:29:30 +0000
On Fri, Oct 04, 2013 at 09:30:00AM +0000, Wolfgang.Stukenbrock@nagler-company.com wrote:
> Mysql server is monitored by a shell script called mysqld_safe
> that wil try to restart the server if it terminates in an
> unexpected way.
> This scripts writes messages on stdout.
> But after the getty is started on /dev/console, stdout of this
> script has been revoked and any write will fail. When
> mysqld_safe tries to write, SIGPIPE is triggerd. SIGPIPE is
> not ingnored, so default action is taken that will immedialy
> kill the process.
... I wouldn't have expected /dev/console to generate SIGPIPE.
Certainly ptys don't; you get EIO. And other stuff that opens the
console during boot normally gets to keep writing to it (AFAICR).
--
David A. Holland
dholland@netbsd.org
From: "Amitai Schlair" <schmonz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48271 CVS commit: pkgsrc/databases
Date: Fri, 5 Dec 2014 17:22:16 +0000
Module Name: pkgsrc
Committed By: schmonz
Date: Fri Dec 5 17:22:16 UTC 2014
Modified Files:
pkgsrc/databases/mysql51-server: Makefile
pkgsrc/databases/mysql51-server/files: mysqld.sh
pkgsrc/databases/mysql55-server: Makefile
pkgsrc/databases/mysql55-server/files: mysqld.sh
pkgsrc/databases/mysql56-server: Makefile
pkgsrc/databases/mysql56-server/files: mysqld.sh
Log Message:
Pipe mysqld_safe's stdout and stderr to syslog to avoid the problem
in PR pkg/48271. (There's a mysqld_safe switch to log to syslog,
which would also work around the problem, at the expense mutually
exclusivity with normal MySQL logging). Bump PKGREVISIONs.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 pkgsrc/databases/mysql51-server/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/databases/mysql51-server/files/mysqld.sh
cvs rdiff -u -r1.24 -r1.25 pkgsrc/databases/mysql55-server/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/databases/mysql55-server/files/mysqld.sh
cvs rdiff -u -r1.19 -r1.20 pkgsrc/databases/mysql56-server/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/databases/mysql56-server/files/mysqld.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: pkg-manager->schmonz
Responsible-Changed-By: schmonz@NetBSD.org
Responsible-Changed-When: Fri, 05 Dec 2014 17:27:32 +0000
Responsible-Changed-Why:
I had this problem too and took a look.
State-Changed-From-To: open->closed
State-Changed-By: schmonz@NetBSD.org
State-Changed-When: Fri, 05 Dec 2014 17:27:32 +0000
State-Changed-Why:
Fixed, differently, by redirecting stdout/stderr to syslog in the rc.d script.
Thanks for the PR!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.