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

Kong 0.13 errors when requesting services and routes simultaneously #3440

Closed
peeyush1234 opened this issue May 8, 2018 · 4 comments
Closed

Comments

@peeyush1234
Copy link

Summary

In my angularjs code, I am making simultaneous requests to fetch services and routes. Here is the code snippet:

(function() {
  angular.module('app').config(['$routeProvider', router]);

  function router($routeProvider) {
    $routeProvider.when('/plugins/add', {
        templateUrl: 'html/plugins/form.html',
        controller: 'PluginController',
        resolve: {
          // Fetching routes        
          routes: ['Kong', function(Kong) {
            return Kong.get('/routes');
          }],
          // Fetching services
          services: ['Kong', function(Kong) {
            return Kong.get('/services');
          }]
        }
        // .... More code
  });
}

One of the calls (either routes or services) is failing randomly.

Below are the logs:

2018/05/08 05:55:33 [error] 34#0: *75038 lua coroutine: runtime error: /usr/local/share/lua/5.1/pgmoon/init.lua:294: bad request
stack traceback:
coroutine 0:
	[C]: in function 'post'
	/usr/local/share/lua/5.1/pgmoon/init.lua:294: in function 'query'
	.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:180: in function 'execute'
	...local/share/lua/5.1/kong/db/strategies/postgres/init.lua:565: in function 'page'
	/usr/local/share/lua/5.1/kong/db/dao/init.lua:217: in function 'page'
	/usr/local/share/lua/5.1/kong/api/endpoints.lua:51: in function </usr/local/share/lua/5.1/kong/api/endpoints.lua:50>
coroutine 1:
	[C]: in function 'resume'
	/usr/local/share/lua/5.1/lapis/application.lua:393: in function 'handler'
	/usr/local/share/lua/5.1/lapis/application.lua:130: in function 'resolve'
	/usr/local/share/lua/5.1/lapis/application.lua:161: in function </usr/local/share/lua/5.1/lapis/application.lua:159>
	[C]: in function 'xpcall'
	/usr/local/share/lua/5.1/lapis/application.lua:159: in function 'dispatch'
	/usr/local/share/lua/5.1/lapis/nginx.lua:215: in function 'serve_admin_api'
	content_by_lua(nginx-kong.conf:141):2: in function <content_by_lua(nginx-kong.conf:141):1>, client: 172.19.0.5, server: kong_admin, request: "GET /services HTTP/1.1", host: "kong:8001"
2018/05/08 05:55:33 [error] 34#0: *75038 [lua] init.lua:133: handle_error(): /usr/local/share/lua/5.1/lapis/application.lua:397: /usr/local/share/lua/5.1/pgmoon/init.lua:294: bad request
stack traceback:
	[C]: in function 'post'
	/usr/local/share/lua/5.1/pgmoon/init.lua:294: in function 'query'
	.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:180: in function 'execute'
	...local/share/lua/5.1/kong/db/strategies/postgres/init.lua:565: in function 'page'
	/usr/local/share/lua/5.1/kong/db/dao/init.lua:217: in function 'page'
	/usr/local/share/lua/5.1/kong/api/endpoints.lua:51: in function </usr/local/share/lua/5.1/kong/api/endpoints.lua:50>

stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/lapis/application.lua:397: in function 'handler'
	/usr/local/share/lua/5.1/lapis/application.lua:130: in function 'resolve'
	/usr/local/share/lua/5.1/lapis/application.lua:161: in function </usr/local/share/lua/5.1/lapis/application.lua:159>
	[C]: in function 'xpcall'
	/usr/local/share/lua/5.1/lapis/application.lua:159: in function 'dispatch'
	/usr/local/share/lua/5.1/lapis/nginx.lua:215: in function 'serve_admin_api'
	content_by_lua(nginx-kong.conf:141):2: in function <content_by_lua(nginx-kong.conf:141):1>, client: 172.19.0.5, server: kong_admin, request: "GET /services HTTP/1.1", host: "kong:8001"

Please let me know if you need any more information. I am using docker compose to setup the kong and postgres.

@thibaultcha
Copy link
Member

Hi,

Thanks for the report. This should be resolved by #3423, which will be included in our next release (likely 0.13.2) very soon. In the meantime, you could apply this patch yourself, or temporarily execute those requests sequentially, if the added latency is acceptable for you.

@kapralVV
Copy link

kapralVV commented Dec 3, 2018

@thibaultcha
Would be happy to know the approximate time when 0.13.2 is released ? Could you provide the updates
Thanks in advance

@thibaultcha
Copy link
Member

@kapralVV As you can see from the CHANGELOG, 0.13.2 was skipped in favor of 0.14.0. You will notice in the Core fixes for this version that this fix is included:

Ensure the PostgreSQL connector of the new DAO (used by Services, Routes, Consumers, and SSL certs/SNIs) is now fully re-entrant and properly behaves in busy workloads (e.g. scripting requests to the Admin API). #3423

@kapralVV
Copy link

kapralVV commented Dec 4, 2018

@thibaultcha
Yep. I see. Many plugins, third party tools support only 0.13 version as API in 0.14 was changed a little bit. Maybe it's good idea to release the LAST 0.13.X with all major bugs-fixes included like this one.
I'll be happy to have it.

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

No branches or pull requests

3 participants