Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a044b48be8a5207680cd24678cf03910c7e7d1b6
      
https://github.com/WebKit/WebKit/commit/a044b48be8a5207680cd24678cf03910c7e7d1b6
  Author: Youenn Fablet <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M Source/WebCore/platform/network/PendingStreamState.cpp
    M Source/WebCore/platform/network/PendingStreamState.h

  Log Message:
  -----------
  m_isInvokingQueueDrainedHandler assertions are thread racy
rdar://183614090
https://bugs.webkit.org/show_bug.cgi?id=320640

Reviewed by Chris Dumez.

The goal of m_isInvokingQueueDrainedHandler assertions is to ensure that, when 
we call the drained handler, we do not synchronously append new data within 
that handler.
But m_isInvokingQueueDrainedHandler assertions are too aggresive.
In particular, if the drained handler is being called on thread A and thread B 
tries to append data, we would assert although this is fine.

We change m_isInvokingQueueDrainedHandler from a bool to the thread id on which 
the drained handler is being called.
We replace the past m_isInvokingQueueDrainedHandler assertions by checking that 
we are not adding data on that specific thread when the drained handler is 
being called.

Covered by existing tests on debug builds.

* Source/WebCore/platform/network/PendingStreamState.cpp:
(WebCore::PendingStreamState::invokeDrainedHandlerIfNeeded):
(WebCore::PendingStreamState::isInvokingQueueDrainedHandlerInSameThread const):
(WebCore::PendingStreamState::appendData):
(WebCore::PendingStreamState::endStream):
(WebCore::PendingStreamState::errorStream):
(WebCore::PendingStreamState::setDataAvailableHandler):
(WebCore::PendingStreamState::readInto):
(WebCore::PendingStreamState::takeAvailableChunks):
* Source/WebCore/platform/network/PendingStreamState.h:

Canonical link: https://commits.webkit.org/318246@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to