bug: event worker failed: failed to receive the header , attempt to index upvalue 'ev' (a nil value)
- Dominant language
- Lua
- Stars
- 17.1k
- Forks
- 2.9k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 62
Description
### Current Behavior
Seeing below error in our production apisix data-plane logs
2025/11/23 10:46:52 [error] 54#54: *643711487 stream [lua] worker.lua:266: communicate(): event worker failed: failed to receive the header bytes: closed, context: ngx.timer 2025/11/23 10:46:52 [error] 116#116: *643711540 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/events/compat/init.lua:47: attempt to index upvalue 'ev' (a nil value) 2025/11/23 10:46:52 [error] 52#52: *643711538 stream [lua] worker.lua:266: communicate(): event worker failed: failed to receive the header bytes: closed, context: ngx.timer
### Expected Behavior
These error logs should not be there.
### Error Logs
2025/11/23 10:46:52 [error] 54#54: *643711487 stream [lua] worker.lua:266: communicate(): event worker failed: failed to receive the header bytes: closed, context: ngx.timer 2025/11/23 10:46:52 [error] 116#116: *643711540 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/events/compat/init.lua:47: attempt to index upvalue 'ev' (a nil value) 2025/11/23 10:46:52 [error] 52#52: *643711538 stream [lua] worker.lua:266: communicate(): event worker failed: failed to receive the header bytes: closed, context: ngx.timer
### Steps to Reproduce
Dont know. Happening in production deployment.
### Environment
- APISIX version (run apisix version):3.14.1
- Operating system (run uname -a):Linux data-plane-7c4b955754-dp552 5.10.230-223.885.amzn2.x86_64 https://github.com/apache/apisix/pull/1 SMP Tue Dec 3 14:36:00 UTC 2024 x86_64 GNU/Linux
- OpenResty / Nginx version (run openresty -V or nginx -V):nginx version: openresty/1.27.1.2 (x86_64-pc-linux-gnu)
built by gcc 15.2.0 (Wolfi 15.2.0-r3)
built with OpenSSL 3.6.0 1 Oct 2025
TLS SNI support enabled
Contributor guide
Research direction
Start by reading worker.lua around line 266 and resty/events/compat/init.lua around line 47, then trace how the event worker communicates and handles a closed connection. Reproduce or isolate the production failure if possible; done means the reported runtime and event-worker error logs no longer occur.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100