Background process received SIGHUP from bash when user logged out from X-window

Solution Verified - Updated -

Issue

  • Our customer's process which was executed on background sometimes received SIGHUP when the customer logged out from X-window.
  • We confirmed the parent process of background process closed by SIGHUP when the background process closed. And, the parent closed by EIO when the background process remained.
  • So, we consider that bash does't send SIGHUP to the background process if bash closes by EIO before receiving SIGHUP. Is this thought correct?

  • Detail Steps:
    1 log in X-window as not root user
    2 execute gnome terminal
    3 change root user by executing su -

      $ su -
    

    4 execute bash

      # bash
    

    5 execute some commands on background (ex. sleep 1000 &)

      # sleep 10000&
    

    6 push "x" buttons of gnome terminal
    7 sleep process remains OR sleep process closes

  • In case of sleep process remained

        ├─gnome-terminal(5272)─┬─bash(5276)───su(5304)───bash(5308)───bash(5336)───sleep(5352)
        │                      ├─gnome-pty-helpe(5275)
        │                      └─{gnome-terminal}(5277)

- bash(5276) closed by SIGHUP.
- bash(5308) closed by EIO.
- bash(5336) closed by EIO.
  • In case of sleep process closed
        ├─gnome-terminal(5140)─┬─bash(5143)───su(5170)───bash(5173)───bash(5201)───sleep(5222)
        │                      ├─gnome-pty-helpe(5142)
        │                      └─{gnome-terminal}(5144)

- bash(5143) closed by SIGHUP.
- bash(5173) closed by EIO.
- bash(5201) closed by SIGHUP.

Environment

  • Red Hat Enterprise Linux 5.7
  • gnome-terminal-2.16.0-5.3.el5_6.1
  • bash-3.2-32.el5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content