bzp2010 commented on PR #10732:
URL: https://github.com/apache/apisix/pull/10732#issuecomment-1872527323
The behavior in the test is the result of the behavior in test::nginx that
cleans up the conf directory, which looks like this:
```
start test =>
start nginx and listen to UNIX socket (create file in conf dir) =>
case 1 =>
reload (test::nginx cleanup conf dir and regenerate nginx.conf file) =>
case 2 (will try to connect a not exist sock file that cleaned by
test::nginx) =>
connect failed and cannot receive events =>
test failed
```
In fact, this was already present when we were still using the conf server
(config_listen.sock will be in ), it's just that the tests back then didn't
strongly rely on this behavior and it couldn't be detected.
There are several ways to fix it:
1. Provide a configuration or environment variable to override the default
sock file path for testing (which can also be set by the user). For testing, we
place the sock file under /tmp.
2. Stop setting USE_HUP for cases that fail in the test, so Nginx will
restart between tests [1], the unix socket will indeed be recreated, and the
test will work.
a. Cases `t/node/healthcheck-multiple-worker.t` and
`t/node/healthcheck-ipv6.t` involved
b. These tests are simple and do not rely on the reload behavior.
Therefore, no impact is expected.
3. Create a new folder such as `tmp` alongside the `conf` folder location to
store these temporary files.
**This PR itself mentions issues that we should be wary of, including but
not limited to files being exposed by container mounts and not being cleaned up
on abnormal exits resulting in failure to start next time.
So we need to choose a way to solve this problem, either one of the above or
your better suggestion.**
Waiting for discussion. cc @monkeyDluffy6017 @shreemaan-abhishek
Ref:
[1] According to Nginx's behavior, when a reload is performed, the newly
started worker will not perform a listen operation again, but will simply reuse
the file descriptor already created by the old worker. This means that if
test::nginx cleans up that sock file between tests, you can still see the unix
socket listening via netstat -lx, but the file doesn't exist and you can't
connect. Therefore, it can be said that the cleanup behavior of test::nginx and
the Nginx reload feature together broke the test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]