fix: docker entrypoint remove stream_worker_events.sock if exists#12546
Conversation
moonming
left a comment
There was a problem hiding this comment.
The Docker image of Apache APISIX has been switched to Ubuntu. Does the debain file still need to be maintained?
|
I don't think we've made that decision yet. If we plan to do so, we need a statement indicating that we are switching from Debian to Ubuntu. In any case, this change is for the dev image, so it should not be controversial. |
|
I want to know when this change will be released? I killed the docker instance of APISIX, then starts the container(simulates host power failure). The APISIX container failed to start with many /usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init
/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init_etcd
trying to initialize the data of etcd
2025/09/25 15:36:40 [emerg] 1#1: bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
2025/09/25 15:36:40 [emerg] 1#1: bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
2025/09/25 15:36:40 [emerg] 1#1: bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
2025/09/25 15:36:40 [emerg] 1#1: bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
2025/09/25 15:36:40 [emerg] 1#1: bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/usr/local/apisix/logs/stream_worker_events.sock failed (98: Address already in use)
2025/09/25 15:36:40 [emerg] 1#1: still could not bind()
nginx: [emerg] still could not bind(The issue will be fixed when I replace image |
Description
If the container exits abnormally, Nginx cannot properly clean up the unix domain socket files it is listening on. When the container is restarted, the startup will fail because the files still exist, preventing the container from starting.
Therefore, we check and delete the files in the entrypoint script of the Docker container. This includes the conf server and event broker.
However, this overlooks the event broker UDS file used by the stream subsystem, so when using TCP/UDP proxies, startup may still fail.
This PR fixes the issue by checking whether the file exists and deleting it if it does.
DEV image
Checklist