[En-Nut-Discussion] Race condition in TCP statemachine

Harald Kipp harald.kipp at egnite.de
Sun Jan 12 13:21:25 CET 2014

Hi Ole,

Your post looks to me, as if Nut/Net is highly unstable "all over the
place". :-) My experience shows, that it is rock solid, running nodes
7d/24h without any interruption.

Why my experience does not fit with your findings?

On 10.01.2014 18:26, Ole Reinhardt wrote:

> NutTcpDestroySocket() is called from different places within the TCP
> statemachine, as well as indirectly from NutTcpCloseSocket() in some
> situation.

As long as it is called in the state machine only, this would not cause
any problem, right?

However, I can see one instance, where a socket is destroyed from within
another context via NutTcpCloseSocket -> NutTcpStateCloseEvent.

In this case the socket is destroyed only, if no connection had been
established on this socket.

Now it fits again: In my applications sockets are rarely closed before
having established at least one connection. In such situations it is
very unlikely, that the state machine handles existing connections. That
makes Nut/Net _looking_ highly reliable, although it contained a severe
race condition bug since its initial release in 2001.




More information about the En-Nut-Discussion mailing list