when forwarding tff files, the plugin reports an error
dantegarden opened this issue · 2 comments
I wrote a custom plugin to control the permission of my application deployed in k8s.
The upstream is a code-server web application.
It can be accessed normally under nginx-ingress.
When I switched from ingress to apisix, most requests can be proxied normally, except for one ttf request like:
http://a1.webide.demo.test/static/out/vs/base/browser/ui/codicons/codicon/codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6
This request returned 503.
Then I looked at the log of apisix, I saw the following error messages:
2022/03/18 13:26:32 [error] 44#44: *295957 [lua] init.lua:703: phase_func(): failed to receive RPC_HTTP_REQ_CALL: timeout, client: 192.168.1.64, server: _, request: "GET /static/out/vs/base/browser/ui/codicons/codicon/codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6 HTTP/1.1", host: "a1.webide.demo.test"
2022/03/18 13:26:32 [warn] 44#44: *295957 [lua] plugin.lua:724: run_plugin(): ext-plugin-pre-req exits with http status code 503, client: 192.168.1.64, server: _, request: "GET /static/out/vs/base/browser/ui/codicons/codicon/codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6 HTTP/1.1", host: "a1.webide.demo.test"
192.168.1.64 - - [18/Mar/2022:13:26:32 +0000] a1.webide.demo.test "GET /static/out/vs/base/browser/ui/codicons/codicon/codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6 HTTP/1.1" 503 596 60.004 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36" - - - "http://a1.webide.demo.test"
192.168.1.64 - - [18/Mar/2022:13:26:33 +0000] a1.webide.demo.test "GET /favicon.ico HTTP/1.1" 304 0 0.308 "http://a1.webide.demo.test/static/out/vs/base/browser/ui/codicons/codicon/codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36" 10.7.230.250:9999 304 0.012 "http://a1.webide.demo.test/favicon.ico"
2022/03/18 13:27:23 [warn] 54#54: *351 [lua] init.lua:775: Exception in thread Thread-44:
Traceback (most recent call last):
File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
, context: ngx.timer
2022/03/18 13:27:23 [warn] 54#54: *351 [lua] init.lua:775: self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.9/site-packages/apache_apisix-0.2.0-py3.9.egg/apisix/runner/server/server.py", line 60, in _threaded
response = handler.dispatch()
File "/usr/lib/python3.9/site-packages/apache_apisix-0.2.0-py3.9.egg/apisix/runner/server/handle.py", line 41, in dispatch
req = NewHttpRequest(self.r)
File "/usr/lib/python3.9/site-packages/apache_apisix-0.2.0-py3.9.egg/apisix/runner/http/request.py", line 63, in __init__
self.__init()
File "/usr/lib/python3.9/site-packages/apache_apisix-0.2.0-py3.9.egg/apisix/runner/http/request.py", line 398, in __init
, context: ngx.timer
2022/03/18 13:27:23 [warn] 54#54: *351 [lua] init.lua:775: arg_dict = runner_utils.parse_dict_vector(req, runner_utils.VECTOR_TYPE_QUERY)
, context: ngx.timer
2022/03/18 13:27:23 [warn] 54#54: *351 [lua] init.lua:775: File "/usr/lib/python3.9/site-packages/apache_apisix-0.2.0-py3.9.egg/apisix/runner/utils/common.py", line 228, in parse_dict_vector
, context: ngx.timer
2022/03/18 13:27:23 [warn] 54#54: *351 [lua] init.lua:775: val = getattr(cls, fn)(i).Value().decode()
AttributeError: 'NoneType' object has no attribute 'decode'
, context: ngx.timer
It seems that some part of the plugin that I haven't changed has blocked the TTF request. Maybe bugs?
How to solve this problem?
Attach my apisixroute:
apiVersion: apisix.apache.org/v2beta2
kind: ApisixRoute
metadata:
name: webide-test
namespace: dev-3woklfan
spec:
http:
- name: rule1
match:
hosts:
- a1.webide.demo.test
paths:
- /*
backends:
- serviceName: webide-ad5c19-ad5c19-svc
servicePort: 30000
websocket: true
plugins:
- name: ext-plugin-pre-req
enable: true
config:
conf:
- name: "authorization"
value: "{\"test\": \"test\"}"
Can you solve this issue for us? It seems to be a simple judgment problem~ @dantegarden
@dantegarden We want to use the python runner in K8s, but are trying to do it with standard container using helm, and mounting the plugin as extra Volumes/mounts .. the debian 3.3.0 image does not have python installed. AM interested in how you achieved getting the runner working .. Thanks in advance