Skip to content

[Windows] cross-login session visibility #4930

Open

Description

@divens

Issue description

When the same Windows user creates a Zellij session from one login context (e.g., SSH) and lists sessions from a different login context (e.g., interactive desktop / RDP), list-sessions incorrectly treats the session as stale and deletes its marker file. The Zellij server process continues running but becomes invisible and unattachable from any context, effectively a zombie session.

Root cause

assert_socket in sessions.rs calls OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION) to check if a session's server process is alive. On Windows, processes spawned in different logon sessions have different security tokens. OpenProcess can return ERROR_ACCESS_DENIED for a live process when the caller's logon session differs from the target's. The current code treats any OpenProcess failure as "process is dead" and deletes the marker file.

Minimal reproduction

  1. Enable OpenSSH server on your Windows machine
  2. SSH into your own machine: ssh youruser@localhost
  3. In the SSH session, create and detach a Zellij session: zellij -s test-session (Ctrl+O, D to detach)
  4. From SSH, verify the session is listed: zellij list-sessions → shows test-session
  5. From the interactive desktop (e.g., Windows Terminal), list sessions: zellij list-sessions
  6. Result: test-session does not appear. The marker file has been deleted.
  7. From SSH, list sessions again: zellij list-sessions → session is gone
  8. The server process is still running (tasklist | Select-String "zellij") but is now unreachable

How to fix

Imrove error handling on OpenProcess() and display "foreign" sessions as such.
PR incoming

Activity

  1. laciferin2024 commented on Mar 28, 2026

    @laciferin2024
    Contributor

    Additionally @divens

    In SSH session,

    Detaching : kills the session !

    But still lists the session, so upon attaching to the session and then switching to RDP to list the session. Session magically appears back in the list but guess what attaching results in infinite hang.

  2. divens commented on Mar 30, 2026

    @divens
    ContributorAuthor

    @laciferin2024 I have not run into this issue. Can you give a step by step repro please?

  3. laciferin2024 commented on Mar 31, 2026

    @laciferin2024
    Contributor

    Sure ,

    Try the same reproducer of yours , but stay in the session (wth ssh) and try list the session in RDP (its there) but u can't attach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions