-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
connect() to unix:/usr/local/kong/go_pluginserver.sock failed(starting instance: nil) #6500
Comments
Hi, when I modified kong/db/dao/plugins/go.lua as you modified(4620c42), got the following err: |
Hi, @javierguerragiraldez , when I run the following bash on the kong pod. Can't connect the go-pluginserver, it's blocked.
Log:
When I using netcat to connect the kong go-pluginserver, also blocked.
But run |
If you're still interested in getting your plugin to run, a better approach would be to show your Go code or, much better, a minimal subset of it that triggers the same "starting instance: no data" message. As mentined elsewhere, this line means that the Go process is crashing when your code is instantiated. |
Hi, @javierguerragiraldez , The full code is in this repo https://github.com/lampnick/kong-rate-limiting-golang/blob/master/custom-rate-limiting.go. The minimal code is:
Thanks! |
@javierguerragiraldez Hello, is there any problems with my go plugin code? |
Hi @javierguerragiraldez, i have same issue as @lampnick. At some point i'm getting error: |
@javierguerragiraldez Hi, I had add pprof to go-pluginserver. Get the following msg, the go-pluginserver deadlocked.
|
I don't see a deadlock. What I see is threads #49 and #3 waiting for the lock held by thread #1 which is currently writing to the log to notify of a closed plugin instance. Please correct me if you think my reading is wrong. If the process is spending a significant amount of time logging for closed instances, I'd say check why are they being closed so often. During normal operation, a plugin instance is only closed after 60 seconds of inactivity and then opened only on the next request that requires the plugin; that makes the closing and reopening task a very sparse occurrence. Unless your plugin is crashing immediately. |
@javierguerragiraldez That's right, it's not a deadlock but got stucked. Goroutint #49 and #3 got stucked because it is waiting for one of the locks in the sync package. |
@tuanpm90 Could you add pprof to your go-pluginserver ? |
@gszr Hi,could you help me to resolve the problem? |
i can't reproduce your error, but your code seems to depend on a global var |
Thank you very much! |
closing issue, please reopen if the issue remains. |
是线程安全的问题么? |
as far as I can tell, the custom plugin was thread-unsafe. Golang is by nature multithreaded. in many cases you can avoid use of locks if you keep all mutable data local and communicate between goroutines via channels; but this was a global dictionary modified from different threads. to keep that thread-safe, you need locks to protect the global variable. |
I have a plugin that have the same problem but i did not use global mutable data.
|
please open a new issue, with relevant versions and log output |
Summary
Kong run normal for a period of time, but a few days later the go plugin invalid. Get the following errors. If run kong prepare and then run kong reload, go plugin work well.
Steps To Reproduce
1.using golang to wrote a plugin
2.loaded go plugin
3.Normal run for a period of time
4.A few days later the go plugin invalid.
Additional Details & Logs
$ kong version
) 2.1.4The text was updated successfully, but these errors were encountered: