[remoting] Wait for PipeWire socket in systemd_user_env_setter [chromium/src : main]

0 views
Skip to first unread message

Yuwei Huang (Gerrit)

unread,
May 20, 2026, 2:13:57 AM (yesterday) May 20
to chromium...@chromium.org, chromotin...@chromium.org

Yuwei Huang added 3 comments

File remoting/host/linux/systemd_user_env_setter.cc
Line 83, Patchset 2 (Latest): socket_name = pipewire_remote_it->second;
Yuwei Huang . unresolved

If `PIPEWIRE_REMOTE` is present in the environment but set to an empty string, `socket_name` will be empty. Later, `runtime_dir.Append("")` will simply return `runtime_dir`. Because `runtime_dir` is an existing directory, `base::PathExists(pw_socket)` will evaluate to `true`, and the check will incorrectly succeed without waiting for the actual socket.

Consider ignoring empty values for `PIPEWIRE_REMOTE` so it falls back to `"pipewire-0"`:
```cpp
if (pipewire_remote_it != env_map.end() && !pipewire_remote_it->second.empty()) {
socket_name = pipewire_remote_it->second;
}
```
Line 103, Patchset 2 (Latest): LOG(WARNING) << "Cannot find the XDG_RUNTIME_DIR environment variable.";
Yuwei Huang . unresolved

This warning message is slightly inaccurate since it could also be that `PIPEWIRE_RUNTIME_DIR` was missing or empty. Consider updating the message to reflect both variables, or something more generic like `"Cannot determine runtime directory for PipeWire socket."`.

Line 200, Patchset 2 (Latest): "Timeout waiting for DISPLAY or "
Yuwei Huang . unresolved

Since the loop now also waits for PipeWire socket readiness, this timeout message might be slightly misleading if it actually timed out waiting for PipeWire. Consider updating the message to reflect that we might also be waiting for the PipeWire socket.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: I1f8143dca6f3b93701b50f5e8cacc332c3734b70
Gerrit-Change-Number: 7863400
Gerrit-PatchSet: 2
Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
Gerrit-Comment-Date: Wed, 20 May 2026 06:13:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Yuwei Huang (Gerrit)

unread,
May 20, 2026, 2:22:34 AM (yesterday) May 20
to chromium...@chromium.org, chromotin...@chromium.org

Yuwei Huang added 5 comments

File remoting/host/linux/systemd_user_env_setter.cc
Line 83, Patchset 2: socket_name = pipewire_remote_it->second;
Yuwei Huang . resolved

If `PIPEWIRE_REMOTE` is present in the environment but set to an empty string, `socket_name` will be empty. Later, `runtime_dir.Append("")` will simply return `runtime_dir`. Because `runtime_dir` is an existing directory, `base::PathExists(pw_socket)` will evaluate to `true`, and the check will incorrectly succeed without waiting for the actual socket.

Consider ignoring empty values for `PIPEWIRE_REMOTE` so it falls back to `"pipewire-0"`:
```cpp
if (pipewire_remote_it != env_map.end() && !pipewire_remote_it->second.empty()) {
socket_name = pipewire_remote_it->second;
}
```
Yuwei Huang

Done

Line 94, Patchset 3 (Latest): if (pipewire_runtime_dir_it != env_map.end()) {
Yuwei Huang . unresolved

Consider checking `!pipewire_runtime_dir_it->second.empty()` here, similar to how it's done for `PIPEWIRE_REMOTE` on line 83. If this variable happens to be present but empty in the systemd environment, it will currently skip falling back to `XDG_RUNTIME_DIR` and cause the `runtime_dir.empty()` check below to fail.

Line 98, Patchset 3 (Latest): if (xdg_runtime_dir_it != env_map.end()) {
Yuwei Huang . unresolved

Similarly, it's safer to check `!xdg_runtime_dir_it->second.empty()` here to ensure we don't try to use an empty path.

Line 103, Patchset 2: LOG(WARNING) << "Cannot find the XDG_RUNTIME_DIR environment variable.";
Yuwei Huang . resolved

This warning message is slightly inaccurate since it could also be that `PIPEWIRE_RUNTIME_DIR` was missing or empty. Consider updating the message to reflect both variables, or something more generic like `"Cannot determine runtime directory for PipeWire socket."`.

Yuwei Huang

Done

Line 200, Patchset 2: "Timeout waiting for DISPLAY or "
Yuwei Huang . resolved

Since the loop now also waits for PipeWire socket readiness, this timeout message might be slightly misleading if it actually timed out waiting for PipeWire. Consider updating the message to reflect that we might also be waiting for the PipeWire socket.

Yuwei Huang

Done

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: I1f8143dca6f3b93701b50f5e8cacc332c3734b70
Gerrit-Change-Number: 7863400
Gerrit-PatchSet: 3
Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
Gerrit-Comment-Date: Wed, 20 May 2026 06:22:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Yuwei Huang <yuw...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Yuwei Huang (Gerrit)

unread,
May 20, 2026, 2:30:35 AM (yesterday) May 20
to chromium...@chromium.org, chromotin...@chromium.org

Yuwei Huang added 2 comments

File remoting/host/linux/systemd_user_env_setter.cc
Line 94, Patchset 3: if (pipewire_runtime_dir_it != env_map.end()) {
Yuwei Huang . resolved

Consider checking `!pipewire_runtime_dir_it->second.empty()` here, similar to how it's done for `PIPEWIRE_REMOTE` on line 83. If this variable happens to be present but empty in the systemd environment, it will currently skip falling back to `XDG_RUNTIME_DIR` and cause the `runtime_dir.empty()` check below to fail.

Yuwei Huang

Done

Line 98, Patchset 3: if (xdg_runtime_dir_it != env_map.end()) {
Yuwei Huang . resolved

Similarly, it's safer to check `!xdg_runtime_dir_it->second.empty()` here to ensure we don't try to use an empty path.

Yuwei Huang

Done

Open in Gerrit

Related details

Attention set is empty
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: I1f8143dca6f3b93701b50f5e8cacc332c3734b70
    Gerrit-Change-Number: 7863400
    Gerrit-PatchSet: 4
    Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Comment-Date: Wed, 20 May 2026 06:30:23 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yuwei Huang (Gerrit)

    unread,
    May 20, 2026, 2:30:46 AM (yesterday) May 20
    to Joe Downing, chromium...@chromium.org, chromotin...@chromium.org
    Attention needed from Joe Downing

    Yuwei Huang voted and added 1 comment

    Votes added by Yuwei Huang

    Auto-Submit+1
    Commit-Queue+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:
    • Joe Downing
    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: I1f8143dca6f3b93701b50f5e8cacc332c3734b70
    Gerrit-Change-Number: 7863400
    Gerrit-PatchSet: 4
    Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
    Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Attention: Joe Downing <joe...@chromium.org>
    Gerrit-Comment-Date: Wed, 20 May 2026 06:30:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joe Downing (Gerrit)

    unread,
    May 20, 2026, 12:03:20 PM (yesterday) May 20
    to Yuwei Huang, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
    Attention needed from Yuwei Huang

    Joe Downing voted

    Code-Review+1
    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Yuwei Huang
    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: I1f8143dca6f3b93701b50f5e8cacc332c3734b70
      Gerrit-Change-Number: 7863400
      Gerrit-PatchSet: 5
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Attention: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Comment-Date: Wed, 20 May 2026 16:03:01 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      May 20, 2026, 12:11:58 PM (yesterday) May 20
      to Yuwei Huang, Joe Downing, chromium...@chromium.org, chromotin...@chromium.org

      Chromium LUCI CQ submitted the change

      Change information

      Commit message:
      [remoting] Wait for PipeWire socket in systemd_user_env_setter

      This is a more or less speculative fix for the bug. I'm not 100% sure
      that the PipeWire connection issue is caused by this race condition, but
      Gemini's explanation (b/514622552#comment4) seems quite plausible.

      In Wayland sessions, the desktop environment might report that the
      session is ready before PipeWire has fully initialized its socket. This
      race condition can lead to desktop capture failures or black screens
      during GDM-to-User session transitions.

      This CL introduces a PipeWire socket readiness check during early host
      startup. We dynamically resolve the PipeWire socket path (respecting
      PIPEWIRE_REMOTE, PIPEWIRE_RUNTIME_DIR, and XDG_RUNTIME_DIR) and poll
      until the socket exists before declaring the systemd user environment
      ready.

      Bug: 514622552

      TAG=agy CONV=0ff425f2-6555-46b9-9039-a1510beb3aff
      Change-Id: I1f8143dca6f3b93701b50f5e8cacc332c3734b70
      Reviewed-by: Joe Downing <joe...@chromium.org>
      Commit-Queue: Joe Downing <joe...@chromium.org>
      Auto-Submit: Yuwei Huang <yuw...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1633630}
      Files:
      • M remoting/host/linux/systemd_user_env_setter.cc
      Change size: M
      Delta: 1 file changed, 54 insertions(+), 3 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Joe Downing
      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: I1f8143dca6f3b93701b50f5e8cacc332c3734b70
      Gerrit-Change-Number: 7863400
      Gerrit-PatchSet: 6
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages