Skip to content

fix: docker entrypoint remove stream_worker_events.sock if exists#12546

Merged
bzp2010 merged 1 commit into
masterfrom
bzp/fix-docker-ep-remove-uds-file
Sep 2, 2025
Merged

fix: docker entrypoint remove stream_worker_events.sock if exists#12546
bzp2010 merged 1 commit into
masterfrom
bzp/fix-docker-ep-remove-uds-file

Conversation

@bzp2010

@bzp2010 bzp2010 commented Aug 23, 2025

Copy link
Copy Markdown
Contributor

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

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Aug 23, 2025

@moonming moonming left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Docker image of Apache APISIX has been switched to Ubuntu. Does the debain file still need to be maintained?

@bzp2010

bzp2010 commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

@moonming

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.
Otherwise, (as is currently the case) we need to maintain both versions.

In any case, this change is for the dev image, so it should not be controversial.

@bzp2010
bzp2010 requested a review from moonming August 26, 2025 03:14
@bzp2010
bzp2010 merged commit a0fd152 into master Sep 2, 2025
36 of 43 checks passed
@jakeslee

Copy link
Copy Markdown

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 Address already in use logs.

/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 apache/apisix:latest with apache/apisix:dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants