[erlang-patches] Strange thing in lib/kernel/src/group.erl

Stefan Zegenhagen <>
Thu May 16 11:41:19 CEST 2013


Dear all,

since the discussion seems to have gotten quiet, I've prepared a patch
to restart the discussion of this topic.

In an interactive shell, the shell process has no means to reliably get
the exit reason of the associated user_drv and, therefore, cannot
meaningfully react on errors reported by the user_drv. However, it
occasionally is required to know why an interactive shell session was
terminated.

The patch attached to this e-mail solves the issue by always propagating
the exit reason of the user_drv to the shell process. In summary, the
patch does the following:

      * propagate the correct exit reason of the user_drv to the shell
        under all circumstances
      * always make sure that the shell process terminates when the
        user_drv has exited
      * give the shell process two seconds time to react on the exit
        signal before forcedly killing it

Shell processes using I/O functionality from the io.erl module will be
largely unaffected because io.erl catches exits of the group_leader()
during io_requests and translates them to {error, terminated} error
codes (independent of the exit reason found in the exit signal). Shell
processes implementing the I/O protocol themselfs might experience
unexpected 'EXIT' reasons.

The patch makes sure that shell is forcedly killed as before, it only
gives the shell process a little time to terminate itself before doing
so. It also makes sure that the shell is killed under *ALL*
circumstances, not just while some I/O client is waiting for input.


Kind regards,

-- 
Dr. Stefan Zegenhagen

arcutronix GmbH
Garbsener Landstr. 10
30419 Hannover
Germany

Tel:   +49 511 277-2734
Fax:   +49 511 277-2709
Email: 
Web:   www.arcutronix.com

*Synchronize the Ethernet*

General Managers: Dipl. Ing. Juergen Schroeder, Dr. Josef Gfrerer -
Legal Form: GmbH, Registered office: Hannover, HRB 202442, Amtsgericht
Hannover; Ust-Id: DE257551767.

Please consider the environment before printing this message.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shell_exit_reason.patch
Type: text/x-patch
Size: 5160 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130516/6efaaa1f/attachment.bin>


More information about the erlang-patches mailing list