[En-Nut-Discussion] Ethernet problem, application crash, problem in NutTcpReceive

Thiago A. Corrêa thiago.correa at gmail.com
Wed Dec 5 21:01:12 CET 2018


I also had to patch tcpsm.c with:

===================================================================
--- tcpsm.c (revision 6727)
+++ tcpsm.c (working copy)
@@ -1943,8 +1943,8 @@
     NutEventBroadcast(&sock->so_ac_tq);
     /* Check if we had a timeout on NutTcpConnect(). In this case there is no
        need for a notification of the select wait queues.
-     */
-    if (!((current_state == TCPS_SYN_SENT) && (last_error == ETIMEDOUT))) {
+    */
+    if (!(current_state == TCPS_SYN_SENT)) {
         /* Wake up all running selects on this socket */
         NutSelectWakeup(sock->so_rx_wq_list, WQ_FLAG_READ);
         NutSelectWakeup(sock->so_tx_wq_list, WQ_FLAG_WRITE);

Was having a crash related to the socket not being signaled as
disconnected and all available memory would be allocated for
retransmissions. I was using select(), not sure if it would only
happen with programs using the newer select api.
It was fairly simple to reproduce using Clumsy and configuring a
packet loss between 3% and 5%


On Sun, Dec 2, 2018 at 2:24 PM Michael Fischer <fischermi at t-online.de> wrote:
>
> Hello Uwe,
>
> >I compiled for the STM32F746 Discovery and can start and stop iperf2
> >runs without crashes. Do crashes happen for you on the F7 disco?
> I can reproduce the crash here too with the F7 disco board. With the patch it works.
>
> Attached is my patch too.
>
> Best regards,
> Michael
>
> -------------- next part --------------
> diff -Naur nut-r6730/nut/net/tcpsock.c nut-r6730-new/nut/net/tcpsock.c
> --- nut-r6730/nut/net/tcpsock.c 2017-04-13 16:05:46.000000000 +0200
> +++ nut-r6730-new/nut/net/tcpsock.c     2018-12-02 17:11:52.662014000 +0100
> @@ -637,6 +637,14 @@
>              return 0;
>      }
>
> +
> +    /* Check again for terminated connection with empty buffer */
> +    if ((sock->so_state != TCPS_ESTABLISHED) && (NULL == sock->so_rx_buf)) {
> +        sock->so_last_error = ENOTCONN;
> +        return -1;
> +    }
> +
> +
>      if (size > sock->so_rx_cnt - sock->so_rd_cnt)
>          size = sock->so_rx_cnt - sock->so_rd_cnt;
>      if (size) {
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion


More information about the En-Nut-Discussion mailing list