libevent / libevent/libevent

TSan ratelim report

Open
#1,206 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

flaky tests
Dominant language
C
Stars
12k
Forks
3.5k
Avg merge
12h 55m
Merged PRs (30d)
6

Description

WARNING: ThreadSanitizer: heap-use-after-free (pid=4275)
  Read of size 8 at 0x7b54000066d0 by main thread:
    #0 event_del_ /home/runner/work/libevent/libevent/event.c:2813:32 (libevent_core-2.2.so.1+0x480bf)
    #1 event_del /home/runner/work/libevent/libevent/event.c:2830:9 (libevent_core-2.2.so.1+0x44a8d)
    #2 delete_all_in_dlist /home/runner/work/libevent/libevent/evmap.c:672:3 (libevent_core-2.2.so.1+0x57b00)
    #3 evmap_io_delete_all_iter_fn /home/runner/work/libevent/libevent/evmap.c:681:9 (libevent_core-2.2.so.1+0x55849)
    #4 evmap_io_foreach_fd /home/runner/work/libevent/libevent/evmap.c:564:12 (libevent_core-2.2.so.1+0x551c4)
    #5 evmap_delete_all_ /home/runner/work/libevent/libevent/evmap.c:696:2 (libevent_core-2.2.so.1+0x5578a)
    #6 event_base_free_ /home/runner/work/libevent/libevent/event.c:885:2 (libevent_core-2.2.so.1+0x39eff)
    #7 event_base_free /home/runner/work/libevent/libevent/event.c:979:2 (libevent_core-2.2.so.1+0x3957d)
    #8 test_ratelimiting /home/runner/work/libevent/libevent/test/test-ratelim.c:552:2 (test-ratelim+0x4b685e)
    #9 main /home/runner/work/libevent/libevent/test/test-ratelim.c:687:9 (test-ratelim+0x4b47bb)

  Previous write of size 8 at 0x7b54000066d0 by main thread:
    #0 free <null> (test-ratelim+0x424698)
    #1 event_mm_free_ /home/runner/work/libevent/libevent/event.c:3608:3 (libevent_core-2.2.so.1+0x366a6)
    #2 bufferevent_finalize_cb_ /home/runner/work/libevent/libevent/bufferevent.c:787:2 (libevent_core-2.2.so.1+0x25549)
    #3 event_process_active_single_queue /home/runner/work/libevent/libevent/event.c:1742:4 (libevent_core-2.2.so.1+0x4f320)
    #4 event_process_active /home/runner/work/libevent/libevent/event.c:1805:9 (libevent_core-2.2.so.1+0x43168)
    #5 event_base_loop /home/runner/work/libevent/libevent/event.c:2047:12 (libevent_core-2.2.so.1+0x40cef)
    #6 event_base_dispatch /home/runner/work/libevent/libevent/event.c:1839:10 (libevent_core-2.2.so.1+0x4001a)
    #7 test_ratelimiting /home/runner/work/libevent/libevent/test/test-ratelim.c:480:3 (test-ratelim+0x4b5d74)
    #8 main /home/runner/work/libevent/libevent/test/test-ratelim.c:687:9 (test-ratelim+0x4b47bb)

https://github.com/libevent/libevent/runs/3643967041?check_suite_focus=true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TSan report and test/test-ratelim.c, especially the paths at lines 480 and 552. Trace the cleanup flow through event.c, evmap.c, and bufferevent.c to understand the reported use-after-free. Done means test-ratelim no longer produces this TSan failure during event-base cleanup.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.