openresty / openresty/lua-nginx-module
lua_socket_log_errors does not suppress errors connecting to unix-domain sockets
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
If using the lua_socket_log_errors off setting, this option seems to have no effect on connection errors to unix-domain sockets. Connection errors to unix domain sockets seem to be logged to the error log regardless of this setting. Compare that to connecting to a host and port, in which case the lua_socket_log_errors off setting successfully suppresses from the error from the nginx error log.
I'm currently testing this against OpenResty 1.15.8.2.
Here's an example:
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
lua_socket_log_errors off;
server {
listen 8080;
location / {
content_by_lua_block {
local sock = ngx.socket.tcp()
sock:connect("unix:/tmp")
}
}
}
}
Which generates this line in the error log:
2019/11/01 15:14:33 [error] 355#355: *1 connect() to unix:/tmp failed (111: Connection refused), client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
Compare that to when connecting to host/ports, like sock:connect("127.0.0.1", 9999) (or some other port that isn't running locally), which does not log any connection refused errors as long as lua_socket_log_errors off is set (but does log connection refused errors when lua_socket_log_errors on).
Is it possible for lua_socket_log_errors to also toggle error logging behavior for unix-domain sockets? Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided nginx configuration and compare the unix-domain socket case with the TCP connection case under lua_socket_log_errors off and on. Trace where connection errors are logged for each path. Done means unix-domain socket errors are suppressed when the setting is off and remain logged when it is on.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100