bzp2010 opened a new pull request, #10732:
URL: https://github.com/apache/apisix/pull/10732

   ### Description
   
   In my last PR #10550, I place the unix socket files in `logs` directory. It 
may be inappropriate because if we use a container environment with log-rotate 
turned on, we may mount the `logs` folder to an external volume, and I think we 
may run into communication and permissions issues.
   
   So this PR moves the sock files to the conf folder, which is probably a 
better choice because that's where we're generating our nginx.conf right now, 
and the same way we used to create conf_server sock file there previously.
   
   In addition, this PR adds some code for cleaning up the sock file to ensure 
that when an Nginx process crashes or is killed, the sock file can be cleaned 
up before the next startup, preventing such errors (this is because the file 
already exists):
   
   ```
   ✗ bin/apisix start
   /usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua start
   nginx.pid exists but there's no corresponding process with pid  1860232 , 
the file will be overwritten
   nginx: [emerg] bind() to unix:/home/bzp/code/apisix/conf/worker_events.sock 
failed (98: Address already in use)
   nginx: [emerg] bind() to unix:/home/bzp/code/apisix/conf/worker_events.sock 
failed (98: Address already in use)
   ```
   
   This often occurs when using containers, and we have to be able to handle it 
correctly.
   
   This feature has not yet been released, so fixing it now is timely and 
involves no compatibility issues. In the meantime, no test cases themselves 
need to be changed.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] 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](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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]

Reply via email to