Fix http handler not found: pre-register via constructor #49
Reference in New Issue
Block a user
Delete Branch "fix/entrypoint-k3s-nonblocking"
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?
elb links without -rdynamic so dlsym fails to find handle_request. Pre-register it in web_stubs.c constructor to fix all routes returning el-runtime: no http handler registered.
elb links without -rdynamic so dlsym(RTLD_DEFAULT, "handle_request") returns NULL at runtime. http_set_handler stores the name as active but never finds a function pointer, causing every request to return "el-runtime: no http handler registered" even after http_serve is called. Fix: add a __attribute__((constructor)) in web_stubs.c that calls el_runtime_register_handler("handle_request", handle_request) directly, bypassing dlsym entirely. The handler is in the registry before main() runs, so http_lookup_active() finds it on the first request.