Skip to content

Probe the session lock with a shared lock on a read-only channel - #30

Merged
CodingInAVan merged 1 commit into
mainfrom
shared-lock-probe
Oct 26, 2026
Merged

CodingInAVan merged 1 commit into
mainfrom
shared-lock-probe

Conversation

@CodingInAVan

Copy link
Copy Markdown
Contributor

Summary

The agent decides that a producer finished by probing its .gpufl-session.lock. The probe opened the lock read-write. An agent running as another user (for example the systemd user gpufl-agent) usually has no write access to it, so the open failed, the state was UNKNOWN, and the session never completed. An H100 run needed chmod g+rw on every lock after each run.

  • Open the lock read-only and try a shared lock. It still conflicts with the writer's exclusive lock (fcntl on POSIX, LockFileEx on Windows), so ACTIVE and UNOWNED mean what they did.
  • When the lock cannot be opened, log one warning per session directory naming the permissions the agent's user needs.
  • Add a README with a section on running the agent as a separate user: the setgid session directory, the producer's umask, and the chmod still needed for clients up to 1.3.0rc6.

Pairs with gpu-flight/gpufl-client#177, which creates the lock group-readable (0660 masked by the umask). Each change is safe without the other: with an older client the agent still cannot open the lock and now says so.

Testing

  • ./gradlew check passes: 176 tests, 1 skipped (a POSIX-only test on this Windows host), coverage gate passed.
  • New: a child JVM holding an exclusive lock on byte 0 (the Windows client's range) probes ACTIVE, then UNOWNED after it exits; and, on Linux/macOS, a mode-400 lock probes UNOWNED while mode 000 probes UNKNOWN. The POSIX test runs first in CI.

The probe opened the producer's lock read-write. An agent running as
another user usually has no write access to it, so the open failed, the
state was UNKNOWN, and the session never completed.

- Open the lock read-only and try a shared lock. It still conflicts with
  the writer's exclusive lock (fcntl on POSIX, LockFileEx on Windows),
  so ACTIVE and UNOWNED mean what they did.
- When the lock cannot be opened, log one warning per session directory
  naming the permissions the agent's user needs.
- Add a README section on running the agent as a separate user.
@CodingInAVan
CodingInAVan merged commit 487603d into main Oct 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant