[all-commits] [llvm/llvm-project] e8ee0f: [lldb] [MainLoopPosix] Fix crash upon adding lots ...

Michał Górny via All-commits all-commits at lists.llvm.org
Mon Oct 17 08:48:58 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8ee0f121dbc2dc20a9de326531c4d4d061a20d8
      https://github.com/llvm/llvm-project/commit/e8ee0f121dbc2dc20a9de326531c4d4d061a20d8
  Author: Michał Górny <mgorny at gentoo.org>
  Date:   2022-10-17 (Mon, 17 Oct 2022)

  Changed paths:
    M lldb/include/lldb/Host/posix/MainLoopPosix.h
    M lldb/source/Host/posix/MainLoopPosix.cpp
    M lldb/unittests/Host/MainLoopTest.cpp

  Log Message:
  -----------
  [lldb] [MainLoopPosix] Fix crash upon adding lots of pending callbacks

If lots of pending callbacks are added while the main loop has exited
already, the trigger pipe buffer fills in, causing the write to fail
and the related assertion to fail.  To avoid this, add a boolean member
indicating whether the callbacks have been triggered already.
If the trigger was done, avoid writing to the pipe until loops proceeds
to run them and resets the variable.

Besides fixing the issue, this also avoids writing to the pipe multiple
times if callbacks are added faster than the loop is able to process
them.  Previously, this would lead to the loop performing multiple read
iterations from pipe unnecessarily.

Sponsored by: The FreeBSD Foundation

Differential Revision: https://reviews.llvm.org/D135516




More information about the All-commits mailing list