LoginSignup
1
3

More than 1 year has passed since last update.

apache が夜中に異常終了(seg fault or similar nasty error detected)

Posted at

環境

CentOS 7.6
httpd-2.4.6-93

現象

apache が夜中3時ごろに、以下のログ出力して異常終了しました。

[Fri Xxx XX 03:XX:XX.XXXXXX 2021] [core:notice] [pid 133248] AH00060: seg fault or similar nasty error detected in the parent process

でもそのまま start コマンド投入したら正常起動しました。

原因

原因は おそらく apache のバグです。
バージョンによりますが、reload(graceful) で再起動を繰り返すと、
再起動の何回目かに、今回のように落ちます。
セマフォだかミューテックスだか(ごめん よく知らないの)がmaxに達するみたい。

で、再起動しているのはログローテーションの
/etc/logrotate.d/httpd
です。
この設定ファイルの中に、再起動の記述があります。

しかもウチでは、デフォルトの weekly から daily に修正していました。
毎日 reload(graceful) で再起動して、最初の稼働から約1年半後に落ちました :dizzy_face:

対応

設定ファイルを以下のように修正しました。
再起動部分を消して、copytruncate を追記しました。

# 修正前
/var/log/httpd/*log {
    daily
    rotate 14
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    endscript
}
# 修正後
/var/log/httpd/*log {
    daily
    rotate 14
    missingok
    notifempty
    delaycompress
    copytruncate
}

これで何かが溜まって異常終了することはありません。
(ただ手動で何百回も reload(graceful) したら同様に落ちます。)

その他

redhat では修正版があるようですが、CentOS7 では無いみたい?
CentOS7 で修正した旨の記事が見当たらない・・・

参考

https://bugzilla.redhat.com/show_bug.cgi?id=1376835
https://access.redhat.com/solutions/2626601
https://bugs.centos.org/view.php?id=15286

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3