You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "nic-6443 (via GitHub)" <gi...@apache.org> on 2023/03/27 06:17:13 UTC

[GitHub] [apisix] nic-6443 opened a new issue, #9171: bug: `apisix start -c config.yaml` report `failed to link customized config, error: File exists` error

nic-6443 opened a new issue, #9171:
URL: https://github.com/apache/apisix/issues/9171

   ### Current Behavior
   
   When starting with a custom configuration file using `start -c`, if it exits abnormally after two starts, an error will occur when trying to start again:`failed to link customized config, error: File exists`
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   ### Reproduction steps
   1. Create a `config.yaml` file.
   ```
   etcd:
     host: 
       - "http://127.0.0.1:22333" # An etcd service that cannot be connected to.
     prefix: "/apisix"
   ```
   2. start apisix three times using this configuration.
   
   First time:
   > [root@apisix-test-6c78bd9db9-d5qkh apisix]# apisix start -c ./config.yaml
   /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua start -c ./config.yaml
   Use customized yaml:    ./config.yaml
   Warning! Request etcd endpoint 'http://127.0.0.1:22333/version' error, connection refused, retry time=1
   Warning! Request etcd endpoint 'http://127.0.0.1:22333/version' error, connection refused, retry time=2
   request etcd endpoint 'http://127.0.0.1:22333/version' error, connection refused
   all etcd nodes are unavailable
   
   Second time:
   > [root@apisix-test-6c78bd9db9-d5qkh apisix]# apisix start -c ./config.yaml
   /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua start -c ./config.yaml
   Use customized yaml:    ./config.yaml
   Warning! Request etcd endpoint 'http://127.0.0.1:22333/version' error, connection refused, retry time=1
   Warning! Request etcd endpoint 'http://127.0.0.1:22333/version' error, connection refused, retry time=2
   request etcd endpoint 'http://127.0.0.1:22333/version' error, connection refused
   all etcd nodes are unavailable
   
   Third time:
   > [root@apisix-test-6c78bd9db9-d5qkh apisix]# apisix start -c ./config.yaml
   /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua start -c ./config.yaml
   **failed to link customized config, error: File exists**
   
   ### Error reason
   https://github.com/apache/apisix/blob/81149cd31567f6a86e33100fa7d09d7550073157/apisix/cli/ops.lua#L806-L817
   `apisix start -c` uses the `rename` system call to rename the existing `config.yaml` to `config.yaml.bak`, and then hard links the custom configuration to `conf/config.yaml`. After two startups, both `config.yaml` and `config.yaml.bak` become hard links  that point to same file. At this point, executing `rename` again will have no effect.
   
   >  [If the old argument and the new argument resolve to the same existing file, rename() shall return successfully and perform no other action. ](https://linux.die.net/man/3/rename#:~:text=If%20the%20old%20argument%20and%20the%20new%20argument%20resolve%20to%20the%20same%20existing%20file%2C%20rename()%20shall%20return%20successfully%20and%20perform%20no%20other%20action.)
   
   This leads to the existence of both `config.yaml` and `config.yaml.bak` in the `conf/` directory after executing `os.rename`, causing a `File exists` error when executing `link`.
   
   ### Environment
   
   /


-- 
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: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 closed issue #9171: bug: `apisix start -c` report `failed to link customized config, error: File exists` error

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 closed issue #9171: bug: `apisix start -c` report `failed to link customized config, error: File exists` error
URL: https://github.com/apache/apisix/issues/9171


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] maiquanghiep commented on issue #9171: bug: `apisix start -c` report `failed to link customized config, error: File exists` error

Posted by "maiquanghiep (via GitHub)" <gi...@apache.org>.
maiquanghiep commented on issue #9171:
URL: https://github.com/apache/apisix/issues/9171#issuecomment-1492922014

   Have you found any solution for this? I also have the same issue 


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] nic-6443 commented on issue #9171: bug: `apisix start -c` report `failed to link customized config, error: File exists` error

Posted by "nic-6443 (via GitHub)" <gi...@apache.org>.
nic-6443 commented on issue #9171:
URL: https://github.com/apache/apisix/issues/9171#issuecomment-1493213465

   > Have you found any solution for this? I also have the same issue 
   
   The problem is not solved yet, you can manually delete the backup files, so that the program can start normally.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] nic-6443 commented on issue #9171: bug: `apisix start -c` report `failed to link customized config, error: File exists` error

Posted by "nic-6443 (via GitHub)" <gi...@apache.org>.
nic-6443 commented on issue #9171:
URL: https://github.com/apache/apisix/issues/9171#issuecomment-1493213433

   The problem is not solved yet, you can manually delete the backup file, so that the program can start normally.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org