erl closing sockets & tables

Per Hedeland per@REDACTED
Sat Jun 17 14:38:59 CEST 2000


Hal Snyder <hal@REDACTED> wrote:
>While testing programs with erl, we've noticed that errors such as
>badmatch and invalid arguments will cause open sockets and (d)ets
>tables to be closed.

Well, sort of - 

- sockets etc are closed when the process owning them exits
- such errors (by default) cause the calling process to exit
- the erlang shell is just another erlang process, i.e. it will exit
  too, and sockets etc opened interactively in the shell will be closed
  - but:
- a new erlang shell is started "automatically" when it exits.

>Is this a bug or a feature?   :-)

The underlying mechanisms (decribed above) that cause the behaviour
you're seeing are fundamental features.:-)

>Is there an accepted way to change this behavior?

There is no way to change it as far as I know - you can of course use
'catch' to prevent the errors from causing an exit, or you can do your
testing differently: E.g. spawn a process that is the one opening
sockets etc, and then talk to that process from the shell (perhaps via
"interface functions") - the shell exiting and restarting will not
affect the spawned process.

--Per Hedeland
per@REDACTED



More information about the erlang-questions mailing list