Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix instance restarting fight. #6507

Merged
merged 1 commit into from
Oct 28, 2020
Merged

Conversation

javierguerragiraldez
Copy link
Contributor

When a Lua coroutine (thread) finds that another thread is starting an
instance, it waits until the other either succeeds or fails. In case of
failure, the original thread fails the request, and the second one
tries again. This retry was wrongly being stored in the old intance
info table which is removed by the failing thread, and never stored
back in the general table by the retrying thread. This fix ensures
that on the failing case the second thread doesn't hold the old info,
but creates a new one.

Issues resolved

Fix #6432 #6500

@eddycjy
Copy link

eddycjy commented Oct 26, 2020

@javierguerragiraldez This is a fatal error. Is there any preliminary released time?

@YegorMedvedev
Copy link

@javierguerragiraldez, @bungle, @gszr, first of all, I would like to thank you for your effort in this project and specifically this fix, but as I can see the only code review is blocking us to release it. Would you consider to raise it up, in order to release the fix as soon as possible, since it's really a blocking issue and I believe a lot of teams are struggling through it?

@gszr
Copy link
Member

gszr commented Oct 28, 2020

@javierguerragiraldez as this is a fix, could we be basing on master?

When a Lua coroutine (thread) finds that another thread is starting an
instance, it waits until the other either succeeds or fails.  In case of
failure, the original thread fails the request, and the second one
tries again.  This retry was wrongly being stored in the old intance
info table which is removed by the failing thread, and never stored
back in the general table by the retrying thread.  This fix ensures
that on the failing case the second thread doesn't hold the old info,
but creates a new one.
@javierguerragiraldez javierguerragiraldez changed the base branch from next to master October 28, 2020 15:40
@javierguerragiraldez javierguerragiraldez merged commit 21d2310 into master Oct 28, 2020
@javierguerragiraldez javierguerragiraldez deleted the fix/go-instance-restart branch October 28, 2020 18:08
@lampnick
Copy link

@javierguerragiraldez Hi,Could you merge it to v2.1.5? I am using kong v2.1.4.Thank you!

@lampnick
Copy link

@javierguerragiraldez Hi, when I modified kong/db/dao/plugins/go.lua as you modified, got the following err:
kong version: v2.1.4
2020/10/30 08:04:17 [error] 53#0: *20086162 [kong] go.lua:427 [custom-rate-limiting] starting instance: no data, client: 172.17.68.1, server: kong, request: "GET /test HTTP/1.1", host: "gateway-test.xxx.com"
2020/10/30 08:04:17 [error] 53#0: *20086162 lua coroutine: runtime error: /usr/local/share/lua/5.1/kong/db/dao/plugins/go.lua:430: no data
stack traceback:
coroutine 0:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/db/dao/plugins/go.lua:430: in function 'get_instance'
/usr/local/share/lua/5.1/kong/db/dao/plugins/go.lua:496: in function </usr/local/share/lua/5.1/kong/db/dao/plugins/go.lua:495>
coroutine 1:
[C]: in function 'resume'
coroutine.wrap:21: in function coroutine.wrap:21
/usr/local/share/lua/5.1/kong/init.lua:756: in function 'access'
access_by_lua(nginx-kong.conf:89):2: in main chunk, client: 172.17.68.1, server: kong, request: "GET /test HTTP/1.1", host: "gateway-test.xxx.com"

@gszr gszr added this to the 2.2.1 milestone Oct 30, 2020
@javierguerragiraldez
Copy link
Contributor Author

Hi @lampnick, from your log it seems the pluginserver is crashing while starting a plugin instance. There might be a problem with your Go code. If necessary, please open a new issue to focus on that.

@lampnick
Copy link

lampnick commented Nov 2, 2020

new
@javierguerragiraldez
Please see #6500,Thanks!

@YegorMedvedev
Copy link

@gszr , any chance to release 2.2.1 at any time soon?

@YegorMedvedev
Copy link

@gszr , estimated release date for 2.2.1, please?

@gszr
Copy link
Member

gszr commented Nov 30, 2020

@YegorMedvedev 2.2.1 will be out in the coming days.

@gszr
Copy link
Member

gszr commented Dec 2, 2020

@YegorMedvedev The 2.2.1 release is now out! Apologies for the delay on my end to give an update and happy Konging!

https://discuss.konghq.com/t/kong-2-2-1-released/7546

@YegorMedvedev
Copy link

@gszr , thanks mate! So far it works as expected ;) Happy Konging you too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting an error "starting instance: nil"
5 participants