Repository navigation
Description
Summary
Follow-on from #376 (the entrypoint case, fixed on 331cbb5): a serving block declared in a plain imported module — not the entrypoint — still fails the identical way the moment Net.HTTP is anywhere in the compiled program, even when neither the serving module nor the entrypoint's own code actually calls into Net.HTTP.
** {'function not exported',
[{'Kex.Store',add,[{'Store.Counter',0},5,#{}],[]},
{kex_intrinsic_process,handle_call,3, ...
The slot dispatches to the right module (that part of #376's original bug is gone), and that module simply has no such export.
The matrix
serving block in |
Net.HTTP imported |
result |
|---|---|---|
| entrypoint | — | works |
| entrypoint | anywhere | works (fixed by #376) |
| imported module | — | works |
| imported module | anywhere | 'function not exported' |
The import breaks it from either side — using Net.HTTP in the serving module itself, or only in the entrypoint — and a bare using Net.HTTP that nothing ever references is enough. It's the dependency's presence in the compilation unit, not any actual use of it.
Repro
Two modules:
# store.kex
module Store
record Counter do
n : Integer = 0
end
serving Counter do
slot add(x: Integer) -> Reply<Integer> do
new.n = @n + x
return { new, reply: new.n }
end
end
# main.kex
using Store
using Net.HTTP, only: [Headers]
main do
let counter = Process.spawn(Store.Counter {})
IO.printLine("${counter.add(5)}")
IO.printLine("${counter.add(3)}")
end
Confirmed still reproducing on current main (b913dac, 2026-09-19) — both the minimal form above and kexhq/rodolfo's actual shape, which is a plain module holding the serving block (no Net.HTTP import of its own) called from a route handler in a main.kex that does using Rodolfo (which itself depends on Net.HTTP). Interesting wrinkle found while re-verifying: swapping the entrypoint's using Net.HTTP, only: [Headers] for using Rodolfo didn't change the crash at all, but the two aren't interchangeable in every other respect I checked — worth keeping in mind that this defect's trigger is sensitive to exactly what else is compiled into the same unit (the same "fragile, depends on what's compiled alongside it" pattern already seen in the Net.Socket/Net.HTTP.WebSocket collision, #360).
Impact
This is the defect that decided kexhq/rodolfo's examples/library architecture: a serving process is the natural home for its book catalog's shared state, but any module holding it that's reachable from a route handler is exactly the failing cell, so the example stores its catalog in a tab-separated file instead.
Root cause (as far as narrowed)
The code generator does not emit the slot exports for a non-entrypoint module once Net.HTTP is part of the program — the same defect #376 already fixed, one level up in module scope. runtime/src/kex_intrinsic_process.erl's invoke_slot dispatch is unchanged and not itself the problem; the export list the generated module ships with is.
Activity
Drop chat's idle-timeout workaround, switch Room's users to a Map
Pull chat's Room into its own module, now that kexhq/kex#386 fixes it