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

Stefan Zegenhagen stefan.zegenhagen@REDACTED
Fri May 3 10:34:40 CEST 2013


Dear all,

I've stumbled across a small issue in the implementation of the process
group server.

The code in group.erl spawns a server process that monitors the exit of
either the shell and the user_drv that started it. In the regular
server_loop, exits of the user_drv (Drv) are handled as follows:

  receive
  ...
  {'EXIT',Drv,R} ->
      exit(R);


When a blocking io_request is being executed, the following code is
executed instead:

  %% 'kill' instead of R, since the shell is not always in
  %% a state where it is ready to handle a termination
  %% message.
  exit_shell(kill),
  exit(R)

Besides the behaviour being inconsistent, it also means that our shell
process monitor receives the 'killed' exit reason more often than the
real exit reason, which defeats our custom error handling and logging.

Looking at the comment above the exit_shell(kill) statement, there seems
to have been a reason to put it there at some time. Looking at the code
in the io module that does those io_requests, it should not be
necessary.

I'm unsure whether it is safe to remove the exit_shell(kill) statement
or whether something would terribly break. However, not receiving the
correct exit reason does give us a headache.


Kind regards,

-- 
Dr. Stefan Zegenhagen

arcutronix GmbH
Garbsener Landstr. 10
30419 Hannover
Germany

Tel:   +49 511 277-2734
Fax:   +49 511 277-2709
Email: stefan.zegenhagen@REDACTED
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.




More information about the erlang-bugs mailing list