Kong / kong-pongo

Tooling to run plugin tests with Kong and Kong Enterprise
Apache License 2.0
154 stars 56 forks source link

Errors during setup - from the stdout logging... #264

Open rkazak opened 2 years ago

rkazak commented 2 years ago

I see the following errors during the initial setup, not sure if these are already addressed?

  Building wheel for multidict (PEP 517): started
  Building wheel for multidict (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpohanydcs
       cwd: /tmp/pip-install-8bhgcpmy/multidict_fffb5a7f135c472dbc4036c87159d568
  Complete output (40 lines):
  *********************
  * Accelerated build *
  *********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/multidict
  copying multidict/_multidict_py.py -> build/lib.linux-x86_64-3.9/multidict
  copying multidict/__init__.py -> build/lib.linux-x86_64-3.9/multidict
  copying multidict/_abc.py -> build/lib.linux-x86_64-3.9/multidict
  copying multidict/_multidict_base.py -> build/lib.linux-x86_64-3.9/multidict
  copying multidict/_compat.py -> build/lib.linux-x86_64-3.9/multidict
  running egg_info
  writing multidict.egg-info/PKG-INFO
  writing dependency_links to multidict.egg-info/dependency_links.txt
  writing top-level names to multidict.egg-info/top_level.txt
  reading manifest file 'multidict.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files found matching 'multidict/_multidict.html'
  warning: no previously-included files found matching 'multidict/*.so'
  warning: no previously-included files found matching 'multidict/*.pyd'
  warning: no previously-included files found matching 'multidict/*.pyd'
  no previously-included directories found matching 'docs/_build'
  adding license file 'LICENSE'
  writing manifest file 'multidict.egg-info/SOURCES.txt'
  copying multidict/__init__.pyi -> build/lib.linux-x86_64-3.9/multidict
  copying multidict/py.typed -> build/lib.linux-x86_64-3.9/multidict
  running build_ext
  building 'multidict._multidict' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/multidict
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.9 -c multidict/_multidict.c -o build/temp.linux-x86_64-3.9/multidict/_multidict.o -O2 -std=c99 -Wall -Wsign-compare -Wconversion -fno-strict-aliasing -pedantic
  multidict/_multidict.c:1:10: fatal error: Python.h: No such file or directory
      1 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for multidict
Failed to build multidict
ERROR: Could not build wheels for multidict which use PEP 517 and cannot be installed directly
fatal: not a git repository (or any of the parent directories): .git
busted 2.0.0 not found, installing via luarocks...
...
gcc -shared -o bit32.so lbitlib.o
Warning: unmatched variable LUA_LIBDIR
make[1]: Entering directory '/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726'
...
...
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra  -Wno-missing-field-initializers  -Wno-override-init -Wno-unused -O2 -fPIC -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/usr/include" -I"/usr/include" -DSOCKET_DEBUG -DHAVE_CONFIG_H -DDNS_RANDOM=RAND_bytes -c -o /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.o /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c: In function 'dns_so_check':
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:6547:17: warning: array subscript -2 is below array bounds of 'unsigned char[1]' [-Warray-bounds]
 6547 |  so->query->data[-2] = 0xff & (so->query->end >> 8);
      |  ~~~~~~~~~~~~~~~^~~~
In file included from /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:83:
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.h:422:17: note: while referencing 'data'
  422 |   unsigned char data[1];
      |                 ^~~~
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:6548:17: warning: array subscript -1 is below array bounds of 'unsigned char[1]' [-Warray-bounds]
 6548 |  so->query->data[-1] = 0xff & (so->query->end >> 0);
      |  ~~~~~~~~~~~~~~~^~~~
In file included from /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:83:
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.h:422:17: note: while referencing 'data'
  422 |   unsigned char data[1];
      |                 ^~~~
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:6550:9: warning: array subscript -2 is below array bounds of 'unsigned char[1]' [-Warray-bounds]
 6550 |  qsrc = &so->query->data[-2] + so->qout;
      |         ^~~~~~~~~~~~~~~~~~~~
In file included from /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:83:
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.h:422:17: note: while referencing 'data'
  422 |   unsigned char data[1];
      |                 ^~~~
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:6576:10: warning: array subscript -2 is below array bounds of 'unsigned char[1]' [-Warray-bounds]
 6576 |   asrc = &so->answer->data[-2];
      |          ^~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:83:
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.h:422:17: note: while referencing 'data'
  422 |   unsigned char data[1];
      |                 ^~~~
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:6587:18: warning: array subscript -2 is below array bounds of 'unsigned char[1]' [-Warray-bounds]
 6587 |    alen = ((0xff & so->answer->data[-2]) << 8)
      |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:83:
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.h:422:17: note: while referencing 'data'
  422 |   unsigned char data[1];
      |                 ^~~~
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:6588:42: warning: array subscript -1 is below array bounds of 'unsigned char[1]' [-Warray-bounds]
 6588 |         | ((0xff & so->answer->data[-1]) << 0);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.c:83:
/tmp/luarocks_cqueues-20200726.51-0-558413/cqueues-rel-20200726/src/lib/dns.h:422:17: note: while referencing 'data'
  422 |   unsigned char data[1];
      |                 ^~~~

We do see

Successfully tagged kong-pongo-test:2.8.0
[pongo-INFO] image 'kong-pongo-test:2.8.0' successfully build

However next we see

Kong version: 2.8.0
[==========] Running tests from scanned files.
[----------] Global test environment setup.
[----------] Running tests from /kong-plugin/spec/myplugin/01-unit_spec.lua
2022/03/10 19:50:22 [warn] [Penlight 1.12.0] the contents of module 'pl.text' has moved into 'pl.stringx' (deprecated after 1.11.0, scheduled for removal in 2.0.0)
[ RUN      ] /kong-plugin/spec/myplugin/01-unit_spec.lua @ 18: myplugin: (schema) accepts distinct request_header and response_header
[       OK ] /kong-plugin/spec/myplugin/01-unit_spec.lua @ 18: myplugin: (schema) accepts distinct request_header and response_header (1.08 ms)
[ RUN      ] /kong-plugin/spec/myplugin/01-unit_spec.lua @ 28: myplugin: (schema) does not accept identical request_header and response_header
[       OK ] /kong-plugin/spec/myplugin/01-unit_spec.lua @ 28: myplugin: (schema) does not accept identical request_header and response_header (1.35 ms)
[----------] 2 tests from /kong-plugin/spec/myplugin/01-unit_spec.lua (981.70 ms total)

[----------] Running tests from /kong-plugin/spec/myplugin/02-integration_spec.lua
/kong-plugin/spec/myplugin/02-integration_spec.lua:28: Error: nginx configuration is invalid (exit code 1):
nginx: the configuration file /kong-plugin/servroot/nginx.conf syntax is ok
nginx: [emerg] chown("/kong-plugin/servroot/client_body_temp", 100) failed (13: Permission denied)
nginx: configuration file /kong-plugin/servroot/nginx.conf test failed

  Run with --v (verbose) or --vv (debug) for more details

stack traceback:
    /kong-plugin/spec/myplugin/02-integration_spec.lua:28: in function </kong-plugin/spec/myplugin/02-integration_spec.lua:11>

/kong-plugin/spec/myplugin/02-integration_spec.lua:28: 2022/03/10 19:51:00 [warn] Support for Cassandra is deprecated. Please refer to https://konghq.com/blog/cassandra-support-deprecated (deprecated after 2.7, scheduled for removal in 4.0)
2022/03/10 19:51:00 [warn] You are using Cassandra but your 'db_update_propagation' setting is set to '0' (default). Due to the distributed nature of Cassandra, you should increase this value.
Error: nginx configuration is invalid (exit code 1):
nginx: the configuration file /kong-plugin/servroot/nginx.conf syntax is ok
nginx: [emerg] chown("/kong-plugin/servroot/client_body_temp", 100) failed (13: Permission denied)
nginx: configuration file /kong-plugin/servroot/nginx.conf test failed

  Run with --v (verbose) or --vv (debug) for more details

stack traceback:
    /kong-plugin/spec/myplugin/02-integration_spec.lua:28: in function </kong-plugin/spec/myplugin/02-integration_spec.lua:11>

/kong-plugin/spec/myplugin/02-integration_spec.lua:28: Error: nginx configuration is invalid (exit code 1):
nginx: the configuration file /kong-plugin/servroot/nginx.conf syntax is ok
nginx: [emerg] chown("/kong-plugin/servroot/client_body_temp", 100) failed (13: Permission denied)
nginx: configuration file /kong-plugin/servroot/nginx.conf test failed

  Run with --v (verbose) or --vv (debug) for more details

stack traceback:
    /kong-plugin/spec/myplugin/02-integration_spec.lua:28: in function </kong-plugin/spec/myplugin/02-integration_spec.lua:11>

[----------] 0 tests from /kong-plugin/spec/myplugin/02-integration_spec.lua (41515.26 ms total)

[----------] Global test environment teardown.
[==========] 2 tests from 2 test files ran. (42497.91 ms total)
[  PASSED  ] 2 tests.
[  ERROR   ] 3 errors, listed below:
[  ERROR   ] /kong-plugin/spec/myplugin/02-integration_spec.lua @ 11: myplugin: (access) [#postgres] lazy_setup
[  ERROR   ] /kong-plugin/spec/myplugin/02-integration_spec.lua @ 11: myplugin: (access) [#cassandra] lazy_setup
[  ERROR   ] /kong-plugin/spec/myplugin/02-integration_spec.lua @ 11: myplugin: (access) [#off] lazy_setup

 3 ERRORS
rkazak@Rohintons-Mac-mini kong-plugin % 
Tieske commented 2 years ago

I cannot reproduce. I ran pongo run from the template plugin repo (https://github.com/Kong/kong-plugin) This is on OSX. What environment are you using?

rkazak commented 2 years ago

Yes I am on OSX Intel(12.2.1). I am using Rancher Desktop with the Docker under pinnings.

dmitrysleptsov commented 2 years ago

Same here. Looks like something changed in kong image in version 2.5.0. Steps to reproduce:

  1. Clone latest kong-pongo master (or 1.0.0 tag, doesn't matter)
  2. KONG_VERSION=2.4.1 ./pongo.sh build - no error (version 2.4.1)
  3. KONG_VERSION=2.5.0 ./pongo.sh build - error as in description (version 2.5.0) If you add python3-dev in Dockerfile - error dissapears
rdrimmie-miovision commented 2 years ago

I am experiencing this behaviour as well. Intel, MacOS 12.3.1, using Rancher Desktop, using the template plugin repo (as well as my project repo, which had worked in its currently state within the past couple of weeks).

I have tried with different versions of kong as suggested above but it does not change the behaviour for me.

Tieske commented 2 years ago

here's a branch: https://github.com/Kong/kong-pongo/pull/283 that fixes the python issue (which also caused httpie not to be installed)

wrt the cqueues warnings; those are notorious. But have never lead to any issues afaik.

I cannot reproduce the test failures reported, and they look like a permissions issue. So maybe try fix that?

@dmitrysleptsov @rdrimmie-miovision do you both also have issues running tests, or just get the warnings in the logs? Could you try the linked branch?

rdrimmie-miovision commented 2 years ago

@Tieske I also have issues running tests. Just integration tests, unit tests pass fine, same behaviour and permission issue as described in the original post.

I can confirm that the debug branch fixes the python issue in my environment. I see no change in the integration test behaviour.

I tried chmod -r 777 ./servroot in the project root to address the permissions issue but that had no effect. I'm somewhat new to using kong and plugins for it, so it's entirely likely that was naive. I'll keep digging at it later today or early next week, and if there are any basic "turn it off and on again" type things that come to mind and you can share I'll give those a try too.

Thanks for the help and quick response!

Editing to add a couple troubleshooting details:

Tieske commented 2 years ago

I presume its permissions, but I frankly suck at unix permissions... so any helkp is appreciated

rdrimmie-miovision commented 2 years ago

I was unable to hone in on a specific cause or resolution. As a workaround a colleague sorted out a Vagrant box running Ubuntu in which to run the tests. Near as we can figure, pongo strongly prefers the native linux docker driver, so the quickest path to us moving forward was to do the work in the vm.

Tieske commented 2 years ago

pongo strongly prefers the native linux docker driver,

@rdrimmie-miovision what were you using that failed?

rdrimmie-miovision commented 2 years ago

2.3 GHz 8-Core Intel Core i9, MacOS 12.3.1, using Rancher Desktop. Reproduced with a fresh clone of the template plugin repo. My setup sounds very similar to yours.

Tieske commented 2 years ago

I've never used Rancher myself. But we've seen other problems with claimed docker compatibility before, iirc RHEL uses another container runtime again. Yet in the details that compatibility then fails.