Skip to content

fix: cleanup stale custom configs with apisix start#9701

Closed
Revolyssup wants to merge 26 commits into
apache:masterfrom
Revolyssup:revolyssup/fix9700
Closed

fix: cleanup stale custom configs with apisix start#9701
Revolyssup wants to merge 26 commits into
apache:masterfrom
Revolyssup:revolyssup/fix9700

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Jun 20, 2023

Copy link
Copy Markdown
Contributor

Description

Fixes #9700

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)

@juststillthinking

Copy link
Copy Markdown
Contributor

Please make the ci pass

Signed-off-by: revolyssup <[email protected]>
@juststillthinking juststillthinking added the wait for update wait for the author's response in this issue/PR label Jun 26, 2023
Signed-off-by: revolyssup <[email protected]>
@Revolyssup

Copy link
Copy Markdown
Contributor Author

@monkeyDluffy6017 please approve ci

@lingsamuel lingsamuel removed the wait for update wait for the author's response in this issue/PR label Jun 26, 2023
@juststillthinking

Copy link
Copy Markdown
Contributor

Could you try to add a test case like this?
https://github.com/apache/apisix/blob/master/t/cli/test_control.sh

@Revolyssup

Copy link
Copy Markdown
Contributor Author

Could you try to add a test case like this? https://github.com/apache/apisix/blob/master/t/cli/test_control.sh

Okay I'll add similar tests cases here.

Signed-off-by: revolyssup <[email protected]>
@Revolyssup

Copy link
Copy Markdown
Contributor Author

@monkeyDluffy6017 I added the tests. Please approve CI

Signed-off-by: revolyssup <[email protected]>
Signed-off-by: revolyssup <[email protected]>
Signed-off-by: revolyssup <[email protected]>
Comment thread apisix/cli/ops.lua Outdated
end
end
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Redundant blanks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@monkeyDluffy6017 Removed redundant lines. Please approve CI again.

Comment thread t/cli/test_cmd.sh
# remove stale conf server sock
touch conf/config_listen.sock
./bin/apisix start
sleep 0.5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you sleep so long?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The tests were failing intermittently on CI as well as my machine. They passed only after giving a long enough sleep between start and stop.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think it takes that long, our ci test is too slow now, please reduce the time

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay Im bringing it to 2.5 but I have seen this test fail a lot due to less sleep time so I hope 2.5 is not too slow, not too fast.

Signed-off-by: revolyssup <[email protected]>
Comment thread apisix/cli/ops.lua
Comment thread apisix/cli/ops.lua
@Sn0rt

Sn0rt commented Jul 7, 2023

Copy link
Copy Markdown
Contributor

update the CI help us to check the codeStyle @Sn0rt

Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
@Sn0rt

Sn0rt commented Jul 11, 2023

Copy link
Copy Markdown
Contributor

LGTM @monkeyDluffy6017 pls help me to review thx

Comment thread t/cli/test_cmd.sh
echo "pass: no corresponding process"
sleep 0.5

# check running when run repeatedly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do you remove this comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Was removed by mistake. Added it back

Signed-off-by: revolyssup <[email protected]>
Comment thread apisix/cli/ops.lua Outdated
Comment on lines +840 to +842
else
-- Cleanup any custom config from previous runs
cleanup()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should not do this in every start, try to catch the error info of util.execute_cmd(env.openresty_args) and do the cleanup

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You mean to check the error of util.execute_cmd(env.openresty_args) and if the error is related to cleanup then cleanup and run util.execute_cmd(env.openresty_args) again?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to run again, call the function cleanup()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay understood

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@monkeyDluffy6017 This is an initialization error and doesn't come from the openresty process. So I think we should check the error of init(env) and do the cleanup in case of error. What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok

Comment thread t/cli/test_cmd.sh

make stop
echo "pass: check APISIX running"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you remove this blank, the below is another test case

@juststillthinking juststillthinking added wait for update wait for the author's response in this issue/PR and removed need test cases labels Jul 11, 2023
@juststillthinking juststillthinking mentioned this pull request Jul 11, 2023
5 tasks
Signed-off-by: revolyssup <[email protected]>
Signed-off-by: revolyssup <[email protected]>
Signed-off-by: revolyssup <[email protected]>
Signed-off-by: revolyssup <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: Ashish Tiwari <[email protected]>
Signed-off-by: revolyssup <[email protected]>
Signed-off-by: revolyssup <[email protected]>
@juststillthinking

Copy link
Copy Markdown
Contributor

I will close this pr because it is fixed by #9846

@Revolyssup
Revolyssup deleted the revolyssup/fix9700 branch October 10, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wait for update wait for the author's response in this issue/PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

apisix prints error of a custom config.yaml when apisix start without the -c

4 participants