8000 serving slots are not exported once the program depends on Net.HTTP (entrypoint case) · Issue #376 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

serving slots are not exported once the program depends on Net.HTTP (entrypoint case) #376

Closed

Description

@akoskovacs

Summary

Filing for the record from kexhq/rodolfo's own bug tracker (docs/kex-issues.md #1), where this was found and fixed before it was ever filed as its own GitHub issue — opening now so there's a place to point at (and reopen from, if it ever regresses).

A serving process whose slots are called from a route handler failed on its first call, the moment the program also depended on Net.HTTP — even when nothing in the program actually called into Net.HTTP:

** exception error: {'function not exported', {Library, add, 3}}

The process started fine, and the exact same slot worked in a program that didn't touch Net.HTTP at all. Adding the dependency — directly via using Net.HTTP, or transitively via using Rodolfo — was enough to break it, regardless of whether the call site spelled the module qualified or not.

Repro (historical — already fixed, see below)

using Net.HTTP, only: [Headers]

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 do
  let counter = Process.spawn(Counter {})
  IO.printLine("${counter.add(5)}")
  IO.printLine("${counter.add(3)}")
end

Root cause (as understood at the time)

The runtime dispatches slots in runtime/src/kex_intrinsic_process.erl (invoke_slot): it checks erlang:function_exported/3 for the declared arity and otherwise retries at arity + 1 with an extra #{}. Both lookups missed, which pointed at the code generator not emitting the slot exports for the compilation unit, rather than at the dispatcher itself.

Status

Fixed on 331cbb5. Re-verified independently on kex main (b913dac, 2026-09-19): the exact repro above runs correctly — add(5) → 5, add(3) → 8 — with a serving block declared directly in the entrypoint module, Net.HTTP imported alongside it either way. Verified in a multi-module layout too, so it wasn't an artifact of a single-file program.

The narrower remaining case — a serving block declared in an imported module (not the entrypoint) still fails the same way when Net.HTTP is anywhere in the program — is filed separately, since it turned out to be a distinct defect once this one was fixed.

Closing on file, since the fix is already confirmed on main.

Activity

  1. added
    BugSomething isn't working
    ImportantNeeds attention sooner rather than later
    on Sep 19, 2026
  2. akoskovacs commented on Sep 19, 2026

    @akoskovacs
    CollaboratorAuthor

    Already fixed on 331cbb5 and re-verified against current main (b913dac) as described above — closing on file.

  3. added a commit that references this issue on Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BEAMBugSomething isn't workingImportantNeeds attention sooner rather than later

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0