Skip to content

lwip: drivers/at86rf2xx/at86rf2xx_netdev.c invalid state during TCP disconnect #17209

@fjmolinas

Description

@fjmolinas

Description

When testing LWIP on at86rf2xx BOARDs an invalid state is often triggered when disconnecting and assert blows.

Steps to reproduce the issue

export CFLAGS="-DDEBUG_ASSERT_VERBOSE"

BOARD=iotlab-m3 LWIP_IPV4=0 LWIP_IPV6=1 make -C tests/lwip --no-print-directory -j flash term

  • server
> udp server start 1337
udp server start 1337
Success: started UDP server on port 1337
> ifconfig
ifconfig
Iface L60 HWaddr: 7a:94:05:ff:25:8d:e7:c3 Link: up State: up
        Link type: wireless
        inet6 addr: fe80:0:0:0:7894:5ff:258d:e7c3 scope: link
> Received UDP data from [fe80::e4d3:6fec:df36:bbe]:49153
00000000  09  87  65  43  21  12  34  56  79  0A  BC  DE  F0
Received UDP data from [fe80::e4d3:6fec:df36:bbe]:49154
00000000  09  87  65  43  21  12  34  56  79  0A  BC  DE  F0
Received UDP data from [fe80::e4d3:6fec:df36:bbe]:49155
00000000  09  87  65  43  21  12  34  56  79
Received UDP data from [fe80::e4d3:6fec:df36:bbe]:49156
00000000  09  87  65  43  21  12  34  56  79  0A  BC  DE  F0
ip server start 255
ip server start 255
Success: started IP server on protocol 255
> Received IP data from [fe80::e4d3:6fec:df36:bbe]:
00000000  09  87  65  43  21  12  34  56  79  0A  BC  DE  F0
Received IP data from [fe80::e4d3:6fec:df36:bbe]:
00000000  09  87  65  43  21  12  34  56  79  0A  BC  DE  F0
tcp server start 1337
tcp server start 1337
Success: started TCP server on port 1337
> TCP client [fe80::e4d3:6fec:df36:bbe]:49153 connected
Received TCP data from client [fe80::e4d3:6fec:df36:bbe]:49153
00000000  09  87  65  43  21  12  34  56  79  0A  BC  DE  F0
TCP connection to [fe80::e4d3:6fec:df36:bbe]:49153 reset
TCP client [fe80::e4d3:6fec:df36:bbe]:49154 connected
TCP connection to [fe80::e4d3:6fec:df36:bbe]:49154 reset
drivers/at86rf2xx/at86rf2xx_netdev.c:775 => 0x80019e5
*** RIOT kernel panic:
FAILED ASSERTION.

        pid | name                 | state    Q | pri | stack  ( used) ( free) | base addr  | current
          - | isr_stack            | -        - |   - |    512 (  244) (  268) | 0x20000000 | 0x200001c8
          1 | main                 | bl mutex _ |   7 |   1536 (  544) (  992) | 0x20001410 | 0x200018dc
          2 | lwip_netdev_mux      | running  Q |   3 |   1024 (  556) (  468) | 0x20003d08 | 0x20003edc
          3 | tcpip_thread         | bl mbox  _ |   1 |   1024 (  808) (  216) | 0x20001bd8 | 0x20001ee4
          4 | UDP server           | bl anyfl _ |   6 |   1024 (  488) (  536) | 0x20000f10 | 0x20001244
          5 | IP server            | bl anyfl _ |   6 |   1024 (  500) (  524) | 0x2000030c | 0x2000062c
          6 | TCP server           | bl anyfl _ |   6 |   1024 (  824) (  200) | 0x200009a4 | 0x20000ccc
            | SUM                  |            |     |   7168 ( 3964) ( 3204)

*** halted.
  • client
udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 0987654321123456790abcdef
udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 0987654321123456790abcdef
Success: send 13 byte over UDP to [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
^[

> udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 0987654321123456790abcdef
udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 0987654321123456790abcdef
Success: send 13 byte over UDP to [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 0987654321123456790abcdef
> udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 098765432112345679

Success: send 9 byte over UDP to [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
> udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 0987654321123456790abcdef
udp send [fe80:0:0:0:7894:5ff:258d:e7c3]:1337 0987654321123456790abcdef
Success: send 13 byte over UDP to [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
> ip send fe80:0:0:0:7894:5ff:258d:e7c3 255 0987654321123456790abcdef
ip send fe80:0:0:0:7894:5ff:258d:e7c3 255 0987654321123456790abcdef
Success: send 13 byte over IPv6 to fe80:0:0:0:7894:5ff:258d:e7c3 (next header: 255)
^[ip send fe80:0:0:0:7894:5ff:258d:e7c3 255 0987654321123456790abcdef
ip send fe80:0:0:0:7894:5ff:258d:e7c3 255 0987654321123456790abcdef
Success: send 13 byte over IPv6 to fe80:0:0:0:7894:5ff:258d:e7c3 (next header: 255)
> tcp connect [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
tcp connect [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
> tcp send 0987654321123456790abcdef
tcp send 0987654321123456790abcdef
Success: send 13 byte over TCP to server
tcp disconnect
tcdisconnect
shell: command not found: tcdisconnect
> tcp disconnect
tcp disconnect
> tcp send 0987654321123456790abcdef
tcp send 0987654321123456790abcdef
could not send
> tcp connect [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
tcp connect [fe80:0:0:0:7894:5ff:258d:e7c3]:1337
> tcp disconnect
tcp disconnect
> ^CConnection to saclay.iot-lab.info closed.

Expected results

Sends and receives successfully.

Actual results

TCP client [fe80::e4d3:6fec:df36:bbe]:49154 connected
TCP connection to [fe80::e4d3:6fec:df36:bbe]:49154 reset
drivers/at86rf2xx/at86rf2xx_netdev.c:775 => 0x80019e5
*** RIOT kernel panic:
FAILED ASSERTION.

        pid | name                 | state    Q | pri | stack  ( used) ( free) | base addr  | current
          - | isr_stack            | -        - |   - |    512 (  244) (  268) | 0x20000000 | 0x200001c8
          1 | main                 | bl mutex _ |   7 |   1536 (  544) (  992) | 0x20001410 | 0x200018dc
          2 | lwip_netdev_mux      | running  Q |   3 |   1024 (  556) (  468) | 0x20003d08 | 0x20003edc
          3 | tcpip_thread         | bl mbox  _ |   1 |   1024 (  808) (  216) | 0x20001bd8 | 0x20001ee4
          4 | UDP server           | bl anyfl _ |   6 |   1024 (  488) (  536) | 0x20000f10 | 0x20001244
          5 | IP server            | bl anyfl _ |   6 |   1024 (  500) (  524) | 0x2000030c | 0x2000062c
          6 | TCP server           | bl anyfl _ |   6 |   1024 (  824) (  200) | 0x200009a4 | 0x20000ccc
            | SUM                  |            |     |   7168 ( 3964) ( 3204)

See assertion line at

assert(dev->pending_tx != 0);

Versions

RIOT: 1772628

Operating System Environment
----------------------------
         Operating System: "Ubuntu" "20.04.1 LTS (Focal Fossa)"
                   Kernel: Linux 5.13.0-1017-oem x86_64 x86_64
             System shell: /usr/bin/dash (probably dash)
             make's shell: /usr/bin/dash (probably dash)

Installed compiler toolchains
-----------------------------
               native gcc: gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0
        arm-none-eabi-gcc: arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)
                  avr-gcc: missing
         mips-mti-elf-gcc: missing
           msp430-elf-gcc: missing
       riscv-none-elf-gcc: missing
  riscv64-unknown-elf-gcc: missing
     riscv-none-embed-gcc: missing
     xtensa-esp32-elf-gcc: missing
   xtensa-esp8266-elf-gcc: missing
                    clang: Ubuntu clang version 12.0.0-3ubuntu1~21.04.2

Installed compiler libs
-----------------------
     arm-none-eabi-newlib: "3.3.0"
      mips-mti-elf-newlib: missing
        msp430-elf-newlib: missing
    riscv-none-elf-newlib: missing
riscv64-unknown-elf-newlib: missing
  riscv-none-embed-newlib: missing
  xtensa-esp32-elf-newlib: missing
xtensa-esp8266-elf-newlib: missing
                 avr-libc: missing (missing)

Installed development tools
---------------------------
                   ccache: ccache version 4.2
                    cmake: cmake version 3.18.4
                 cppcheck: Cppcheck 2.3
                  doxygen: 1.9.1
                      git: git version 2.30.2
                     make: GNU Make 4.3
                  openocd: Open On-Chip Debugger 0.11.0+dev-00282-gae6de2f93-dirty (2021-07-29-18:16)
                   python: Python 3.9.5
                  python2: Python 2.7.18
                  python3: Python 3.9.5
                   flake8: error: /usr/bin/python3: No module named flake8
               coccinelle: spatch version 1.1.1-00068-g49826315 compiled with OCaml version 4.08.1

Metadata

Metadata

Assignees

Labels

Type: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions