Skip to content

Segfault during cleanup_server for bidirectional or with parallel stream tests ended early #1696

Description

@MattCatz

Context

  • Version of iperf3: 3.16

  • Hardware: N/A

  • Operating system (and distribution, if any): 6.5.0-26-generic # 26~22.04.1-Ubuntu

  • Other relevant information (for example, non-default compilers,
    libraries, cross-compiling, etc.): N/A

Bug Report

While doing some testing I would occasionally use the wrong iperf flags/parameters and would terminate the test early rather than waiting for it to run completely.

  • Expected Behavior: Terminating a test early causes the client and server to stop testing. The client cleans up and terminates. The server cleans up and prepares for next test.

  • Actual Behavior: Server segfaults during cleanup

  • Steps to Reproduce

    1. Simulate a high-ish latency link on the loopback interface: tc qdisc add dev lo root netem delay 50ms
    2. Start server: iperf3 -s
    3. Start client and terminate test early: iperf3 -c 127.0.0.1 -t 10 -P 10 or iperf3 -c 127.0.0.1 -t 10 --bidir
      • It seems to be a race condition so to have better chances at finding it I'll typically run something like for i in $(seq 100); do iperf3 -c 127.0.0.1 -t 10 -P 10; done then repeatedly use ctrl-c to kill tests.
    4. Check server crashed
  • Possible Solution
    Adding an assert into the code here shows the root cause. Something like assert(sp->thr != 0);. This would indicate that a NULL values is being passed into pthread_cancel. A possible solution would be a NULL check before attempting to cancel the thread.

  • Other observations
    I was not able to reproduce the issue using 3.15 as the server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions