remoting multi-process Linux: flock(2) the host config file [chromium/src : main]

0 views
Skip to first unread message

Yuwei Huang (Gerrit)

unread,
Apr 1, 2026, 6:31:00 PM (2 days ago) Apr 1
to Lambros Lambrou, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
Attention needed from Lambros Lambrou

Yuwei Huang voted and added 1 comment

Votes added by Yuwei Huang

Auto-Submit+1

1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Yuwei Huang . resolved

PTAL thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Lambros Lambrou
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: I1ed76f52190ee39807028b51b37bf6f1f454c05f
Gerrit-Change-Number: 7722633
Gerrit-PatchSet: 4
Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
Gerrit-Reviewer: Lambros Lambrou <lambros...@chromium.org>
Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
Gerrit-Attention: Lambros Lambrou <lambros...@chromium.org>
Gerrit-Comment-Date: Wed, 01 Apr 2026 22:30:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Lambros Lambrou (Gerrit)

unread,
Apr 1, 2026, 6:54:11 PM (2 days ago) Apr 1
to Yuwei Huang, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
Attention needed from Yuwei Huang

Lambros Lambrou voted and added 1 comment

Votes added by Lambros Lambrou

Code-Review+1

1 comment

File remoting/host/linux/daemon_process_main.cc
Line 91, Patchset 4 (Latest): if (flock(config_file_lock.GetPlatformFile(), LOCK_EX | LOCK_NB) == -1) {
Lambros Lambrou . unresolved

Other usages in Chromium wrap flock() inside HANDLE_EINTR (even the ones that use LOCK_NB). Would that make sense here? Then you can remove the EAGAIN/EWOULDBLOCK check below.

Open in Gerrit

Related details

Attention is currently required from:
  • Yuwei Huang
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: I1ed76f52190ee39807028b51b37bf6f1f454c05f
    Gerrit-Change-Number: 7722633
    Gerrit-PatchSet: 4
    Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Reviewer: Lambros Lambrou <lambros...@chromium.org>
    Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Attention: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 22:54:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yuwei Huang (Gerrit)

    unread,
    Apr 1, 2026, 7:01:01 PM (2 days ago) Apr 1
    to Lambros Lambrou, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org

    Yuwei Huang voted and added 2 comments

    Votes added by Yuwei Huang

    Auto-Submit+1
    Commit-Queue+2

    2 comments

    Patchset-level comments
    File-level comment, Patchset 5 (Latest):
    Yuwei Huang . resolved

    Thanks!

    File remoting/host/linux/daemon_process_main.cc
    Line 91, Patchset 4: if (flock(config_file_lock.GetPlatformFile(), LOCK_EX | LOCK_NB) == -1) {
    Lambros Lambrou . resolved

    Other usages in Chromium wrap flock() inside HANDLE_EINTR (even the ones that use LOCK_NB). Would that make sense here? Then you can remove the EAGAIN/EWOULDBLOCK check below.

    Yuwei Huang

    Done. `EINTR` is for signal interruption, which is different from `EAGAIN/EWOULDBLOCK`. The check below is just to show a better error message in case the lock is held by another process.

    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: I1ed76f52190ee39807028b51b37bf6f1f454c05f
      Gerrit-Change-Number: 7722633
      Gerrit-PatchSet: 5
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Lambros Lambrou <lambros...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Apr 2026 23:00:49 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Lambros Lambrou <lambros...@chromium.org>
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Apr 1, 2026, 7:49:23 PM (2 days ago) Apr 1
      to Yuwei Huang, Lambros Lambrou, chromium...@chromium.org, chromotin...@chromium.org

      Chromium LUCI CQ submitted the change with unreviewed changes

      Unreviewed changes

      4 is the latest approved patch-set.
      The change was submitted with unreviewed changes in the following files:

      ```
      The name of the file: remoting/host/linux/daemon_process_main.cc
      Insertions: 3, Deletions: 1.

      @@ -13,6 +13,7 @@
      #include "base/functional/bind.h"
      #include "base/logging.h"
      #include "base/memory/scoped_refptr.h"
      +#include "base/posix/eintr_wrapper.h"
      #include "base/run_loop.h"
      #include "base/strings/stringprintf.h"
      #include "base/task/single_thread_task_executor.h"
      @@ -88,7 +89,8 @@
      // processes from using the same host config file. Only root processes can
      // apply locks to the config file, and the lock will be released once the file
      // descriptor is closed or the process is dead.
      - if (flock(config_file_lock.GetPlatformFile(), LOCK_EX | LOCK_NB) == -1) {
      + if (HANDLE_EINTR(
      + flock(config_file_lock.GetPlatformFile(), LOCK_EX | LOCK_NB)) == -1) {
      // Note: EWOULDBLOCK and EAGAIN are expanded to the same value.
      PLOG(ERROR)
      << ((errno == EWOULDBLOCK || errno == EAGAIN)
      ```

      Change information

      Commit message:
      remoting multi-process Linux: flock(2) the host config file

      The single-process host's Python script prevents multiple hosts from
      running by checking if the host process is running. This CL adds
      something similar to the multi-process host, but instead of just
      checking the process, which is fragile since it won't work for dev build
      hosts, it applies an advisory file lock (flock(2)) on the host config
      file.
      Bug: 498368030
      Change-Id: I1ed76f52190ee39807028b51b37bf6f1f454c05f
      Reviewed-by: Lambros Lambrou <lambros...@chromium.org>
      Commit-Queue: Yuwei Huang <yuw...@chromium.org>
      Auto-Submit: Yuwei Huang <yuw...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1608865}
      Files:
      • M remoting/host/linux/daemon_process_main.cc
      Change size: S
      Delta: 1 file changed, 29 insertions(+), 0 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Lambros Lambrou
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I1ed76f52190ee39807028b51b37bf6f1f454c05f
      Gerrit-Change-Number: 7722633
      Gerrit-PatchSet: 6
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Lambros Lambrou <lambros...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages