[erlang-questions] A question on EINVAL in active-mode TCP

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Thu Jun 30 15:58:59 CEST 2016


On Thu, Jun 30, 2016 at 10:58 AM, Magnus Ottenklinger <
magnus.ottenklinger@REDACTED> wrote:

> We stumbled over a peculiarity in the usage of ports in a TCP connection
> (active mode). Specifically, we encountered `einval` when writing to a
> socket which was closed just before. Our expectation was that the resulting
> error should be `{error,closed}`. The following module reproduces this on
> my machine (OTP 19.0). I ran the test module with `erlc test.erl && erl -s
> test run -noshell` as well as with `erl -smp disable +A 0 -s test run
> -noshell`. Both executions triggered `einval`.


Knowing what operating system it is could help. Low level TCP isn't
entirely the same thing in its response codes, even though POSIX exists.
There are some things down here which are up to "interpretation" for some
levels of interpretation.

It does, from your failing program, look like it is a race however. The
question is if anything can be done about it.



-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160630/ee2ffc8a/attachment.htm>


More information about the erlang-questions mailing list