KAIMONSLATE_PORT is captured at precompile time, so a launcher can't pin the hub port #6
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
kahliburke/KaimonSlate.jl#6
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello, I found a potential bug in the custom port customization for the KaimonSlate server. Here is the AI assisted report below
Summary
The hub port is defined as a top-level
constthat reads the environment in the modulebody (
src/KaimonSlate.jl:148):Top-level module code is evaluated during precompilation, so this value is baked into
the precompiled image and is not re-read when the module loads in a new process
(see the Julia manual,
Module initialization and precompilation,
which is why runtime state like environment variables must be read from
__init__).KAIMONSLATE_PORTtherefore only takes effect if it happened to be set in the environmentthat produced the
.ji; setting it in the launcher/process environment at start has noeffect once a precompiled cache exists. This contradicts the comment just above it
(lines 146–147: "configurable via the KAIMONSLATE_PORT env var … so a config UI / launcher
can pin it").
It's especially easy to hit with the Kaimon-managed extension environment (Kaimon.jl #65):
KaimonSlate precompiles on the first
usinginside the spawned extension, so whicheverenvironment that first spawn had fixes the port for every later spawn — even though each
spawn inherits the (correct) launcher env. Observed: the process's
/proc/<pid>/environshows
KAIMONSLATE_PORT=<TARGET PORT>, while the hub log line readsKaimon Slate hub url = http://127.0.0.1:8765(the baked-in default).Affected code
src/KaimonSlate.jl:148(the const), consumed at:_base()—src/KaimonSlate.jl:152_hub()→start_hub(; port = _PORT)—src/KaimonSlate.jl:157src/app.jl:711Expected
KAIMONSLATE_PORTis read at process start, so a launcher / config UI can pin the portreliably regardless of the precompile-time environment.
Working fix (tried locally on my fork)
Reading the port at runtime in
__init__(which is skipped during precompilation), holdingit in a
Ref, fixes it for me:and using
_PORT[]at the call sites. Happy to open a PR.