[SyncPreview] Add callback triggered when all accounts are fetched [chromium/src : main]

0 views
Skip to first unread message

Ryan Sultanem (Gerrit)

unread,
Jul 8, 2026, 9:53:29 AM (2 days ago) Jul 8
to Pâris Meuleman, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Pâris Meuleman

Ryan Sultanem added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Ryan Sultanem . resolved

Thanks for checking this one too!

Open in Gerrit

Related details

Attention is currently required from:
  • Pâris Meuleman
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5ec6de73e64e67f30b77c7f60c603d9173fba1c5
Gerrit-Change-Number: 8031344
Gerrit-PatchSet: 4
Gerrit-Owner: Ryan Sultanem <rs...@google.com>
Gerrit-Reviewer: Pâris Meuleman <pmeu...@chromium.org>
Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
Gerrit-Attention: Pâris Meuleman <pmeu...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Jul 2026 13:53:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Pâris Meuleman (Gerrit)

unread,
Jul 9, 2026, 5:06:25 AM (yesterday) Jul 9
to Ryan Sultanem, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Ryan Sultanem

Pâris Meuleman voted and added 3 comments

Votes added by Pâris Meuleman

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Pâris Meuleman . resolved

LGTM with a question on the risk of races between network delay helper and the barrier.

File components/signin/core/browser/account_preview_data_service_impl.cc
Line 131, Patchset 5 (Latest): all_accounts_fetched_barrier_.Run();
Pâris Meuleman . unresolved

I wonder if this might crash if either accounts are removed while the fetch is in network_Delay_helper_, or if the periodic fetch resets the barrier in the same situation?
in that case just counting the successful fetches might not be resilient enough?

File components/signin/core/browser/account_preview_data_service_impl_unittest.cc
Line 275, Patchset 5 (Latest): AllDataAvailableWaiter waiter(service_.get());
Pâris Meuleman . unresolved

optional nit: can the lifetime of the waiter be a problem here if e.g. it gets deleted before the callback is invoked, maybe by an early returning assertion ? that'd lead to flaky failures

Open in Gerrit

Related details

Attention is currently required from:
  • Ryan Sultanem
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I5ec6de73e64e67f30b77c7f60c603d9173fba1c5
    Gerrit-Change-Number: 8031344
    Gerrit-PatchSet: 5
    Gerrit-Owner: Ryan Sultanem <rs...@google.com>
    Gerrit-Reviewer: Pâris Meuleman <pmeu...@chromium.org>
    Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
    Gerrit-Attention: Ryan Sultanem <rs...@google.com>
    Gerrit-Comment-Date: Thu, 09 Jul 2026 09:06:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ryan Sultanem (Gerrit)

    unread,
    5:55 AM (1 hour ago) 5:55 AM
    to Pâris Meuleman, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Pâris Meuleman

    Ryan Sultanem added 3 comments

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Ryan Sultanem . resolved

    Thanks Paris!

    File components/signin/core/browser/account_preview_data_service_impl.cc
    Line 131, Patchset 5: all_accounts_fetched_barrier_.Run();
    Pâris Meuleman . unresolved

    I wonder if this might crash if either accounts are removed while the fetch is in network_Delay_helper_, or if the periodic fetch resets the barrier in the same situation?
    in that case just counting the successful fetches might not be resilient enough?

    Ryan Sultanem

    That is actually a good point - since the active fetcher is not set yet.

    We can do one of:

    • Create the fetcher but not activate it until the network is established, and therefore validating that the fetcher is still alive (not destroyed by the account being removed).
    • Before creating the fetcher and after the network is established, ensure that the gaia_id is still linked to a signed in account.

    I believe I will follow the second option, as it is slightly more straightforward. Let me knnow what you think!

    File components/signin/core/browser/account_preview_data_service_impl_unittest.cc
    Line 275, Patchset 5: AllDataAvailableWaiter waiter(service_.get());
    Pâris Meuleman . unresolved

    optional nit: can the lifetime of the waiter be a problem here if e.g. it gets deleted before the callback is invoked, maybe by an early returning assertion ? that'd lead to flaky failures

    Ryan Sultanem

    Do you mean in this test or in general? I believe that in this test or any test that will call `Wait()` that this should not be possible.

    I can add an assertion at the destructor that checks whether `is_all_data_available_` is `true` and that `run_loop_` is not currently running. Is this what you meant?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Pâris Meuleman
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I5ec6de73e64e67f30b77c7f60c603d9173fba1c5
    Gerrit-Change-Number: 8031344
    Gerrit-PatchSet: 7
    Gerrit-Owner: Ryan Sultanem <rs...@google.com>
    Gerrit-Reviewer: Pâris Meuleman <pmeu...@chromium.org>
    Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
    Gerrit-Attention: Pâris Meuleman <pmeu...@chromium.org>
    Gerrit-Comment-Date: Fri, 10 Jul 2026 09:55:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Pâris Meuleman <pmeu...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Pâris Meuleman (Gerrit)

    unread,
    6:11 AM (1 hour ago) 6:11 AM
    to Ryan Sultanem, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Ryan Sultanem

    Pâris Meuleman voted and added 2 comments

    Votes added by Pâris Meuleman

    Code-Review+1

    2 comments

    File components/signin/core/browser/account_preview_data_service_impl.cc
    Line 131, Patchset 5: all_accounts_fetched_barrier_.Run();
    Pâris Meuleman . unresolved

    I wonder if this might crash if either accounts are removed while the fetch is in network_Delay_helper_, or if the periodic fetch resets the barrier in the same situation?
    in that case just counting the successful fetches might not be resilient enough?

    Ryan Sultanem

    That is actually a good point - since the active fetcher is not set yet.

    We can do one of:

    • Create the fetcher but not activate it until the network is established, and therefore validating that the fetcher is still alive (not destroyed by the account being removed).
    • Before creating the fetcher and after the network is established, ensure that the gaia_id is still linked to a signed in account.

    I believe I will follow the second option, as it is slightly more straightforward. Let me knnow what you think!

    Pâris Meuleman

    Both seem viable yes, going with the second SGTM.

    File components/signin/core/browser/account_preview_data_service_impl_unittest.cc
    Line 275, Patchset 5: AllDataAvailableWaiter waiter(service_.get());
    Pâris Meuleman . unresolved

    optional nit: can the lifetime of the waiter be a problem here if e.g. it gets deleted before the callback is invoked, maybe by an early returning assertion ? that'd lead to flaky failures

    Ryan Sultanem

    Do you mean in this test or in general? I believe that in this test or any test that will call `Wait()` that this should not be possible.

    I can add an assertion at the destructor that checks whether `is_all_data_available_` is `true` and that `run_loop_` is not currently running. Is this what you meant?

    Pâris Meuleman

    I think: if an assertion fails before wait(), destructing the waiter, then AccountPreviewDataService might call OnAllDataAvailable on a dangling pointer, i.e. UAF.
    we could in the dtor cleanup the services' callback or use a weak pointer in SetAllDataAvailableCallbackForTesting

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ryan Sultanem
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I5ec6de73e64e67f30b77c7f60c603d9173fba1c5
    Gerrit-Change-Number: 8031344
    Gerrit-PatchSet: 7
    Gerrit-Owner: Ryan Sultanem <rs...@google.com>
    Gerrit-Reviewer: Pâris Meuleman <pmeu...@chromium.org>
    Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
    Gerrit-Attention: Ryan Sultanem <rs...@google.com>
    Gerrit-Comment-Date: Fri, 10 Jul 2026 10:11:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Pâris Meuleman <pmeu...@chromium.org>
    Comment-In-Reply-To: Ryan Sultanem <rs...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ryan Sultanem (Gerrit)

    unread,
    6:54 AM (25 minutes ago) 6:54 AM
    to Pâris Meuleman, Chromium LUCI CQ, chromium...@chromium.org

    Ryan Sultanem added 3 comments

    Patchset-level comments
    File-level comment, Patchset 8 (Latest):
    Ryan Sultanem . resolved

    THanks!

    File components/signin/core/browser/account_preview_data_service_impl.cc
    Line 131, Patchset 5: all_accounts_fetched_barrier_.Run();
    Pâris Meuleman . resolved

    I wonder if this might crash if either accounts are removed while the fetch is in network_Delay_helper_, or if the periodic fetch resets the barrier in the same situation?
    in that case just counting the successful fetches might not be resilient enough?

    Ryan Sultanem

    That is actually a good point - since the active fetcher is not set yet.

    We can do one of:

    • Create the fetcher but not activate it until the network is established, and therefore validating that the fetcher is still alive (not destroyed by the account being removed).
    • Before creating the fetcher and after the network is established, ensure that the gaia_id is still linked to a signed in account.

    I believe I will follow the second option, as it is slightly more straightforward. Let me knnow what you think!

    Pâris Meuleman

    Both seem viable yes, going with the second SGTM.

    Ryan Sultanem

    Acknowledged

    File components/signin/core/browser/account_preview_data_service_impl_unittest.cc
    Line 275, Patchset 5: AllDataAvailableWaiter waiter(service_.get());
    Pâris Meuleman . resolved

    optional nit: can the lifetime of the waiter be a problem here if e.g. it gets deleted before the callback is invoked, maybe by an early returning assertion ? that'd lead to flaky failures

    Ryan Sultanem

    Do you mean in this test or in general? I believe that in this test or any test that will call `Wait()` that this should not be possible.

    I can add an assertion at the destructor that checks whether `is_all_data_available_` is `true` and that `run_loop_` is not currently running. Is this what you meant?

    Pâris Meuleman

    I think: if an assertion fails before wait(), destructing the waiter, then AccountPreviewDataService might call OnAllDataAvailable on a dangling pointer, i.e. UAF.
    we could in the dtor cleanup the services' callback or use a weak pointer in SetAllDataAvailableCallbackForTesting

    Ryan Sultanem

    Oh I see now, thanks! This would happen in case of failures. Yes then clearing the callback in the destructor would fix it!

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I5ec6de73e64e67f30b77c7f60c603d9173fba1c5
      Gerrit-Change-Number: 8031344
      Gerrit-PatchSet: 8
      Gerrit-Owner: Ryan Sultanem <rs...@google.com>
      Gerrit-Reviewer: Pâris Meuleman <pmeu...@chromium.org>
      Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
      Gerrit-Comment-Date: Fri, 10 Jul 2026 10:54:24 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages