easegress
easegress copied to clipboard
It will hapen endless loop when a http request through a mirror pool of pipeline
Describe the bug when I config the pipeline with mainPool and a mirrorPool,and request with http header to through the mirrorPool(like example http-pipeline-example.yaml in source, set header X-Filter=mirror ), it will response nothing
To Reproduce Steps to reproduce the behavior:
- update http-pipeline-example.yaml in example/config,keep mainPool and mirrorPool,just remain http-pipeline-example.yaml and http-server-example.yaml
- start cluster and create objects
- send request with header X-Filter=mirror
- cannot get any response
Expected behavior response correct data
Version all version
Configuration
- HTTP server configuration
kind: HTTPServer
name: http-server-example
port: 10080
https: false
http3: false
keepAlive: true
keepAliveTimeout: 75s
maxConnection: 10240
cacheSize: 0
rules:
- paths:
- pathPrefix: /pipeline
backend: http-pipeline-example
- Pipeline Configuration
name: http-pipeline-example
kind: HTTPPipeline
flow:
- filter: proxy
jumpIf: { fallback: END }
- filter: responseAdaptor
filters:
- name: proxy
kind: Proxy
failureCodes: [500, 501]
fallback:
forCodes: true
forCircuitBreaker: false
mockCode: 200
mockHeader: {X-Fallback: yes}
mockBody: '{"message": "Backend failed, try it later."}'
mirrorPool:
servers:
- url: http://127.0.0.1:9092
loadBalance:
policy: roundRobin
headerHashKey: ""
filter:
headers:
X-Filter:
exact: mirror
mainPool:
servers:
- url: http://127.0.0.1:9091
tags: ["blue", "v2"]
loadBalance:
policy: roundRobin
headerHashKey: X-User-Id
compression:
minLength: 1024
- name: responseAdaptor
kind: ResponseAdaptor
header:
del: []
set:
Server: Easegress v1.0.0
add:
X-Proxy-Name: http-proxy-exmaple
I review the code, in proxy.go,primaryReader and body of HttpRequest reference each other. when method body.Close() is called in httpContext.Finish(),primaryReader.Close() is called, and then body.Close() ...
Thanks for raising this, we will look into the issue, and also welcome you to open a PR to fix it.
Hi, thanks for your question. mirrorPool
just send the requests to corresponding backend, the response from mirrorPool
is ignored (it is just a mirror, the response comes from mainPool
or one of candidatePools
). So do you mean mirrorPool
backend does not get the request or just mirrorPool
response not return?
If you want to use filter
to send requests to different backends, please use candidatePools
...
@suchen-sci I see mirrorPool will not writeResponse. but when body.close,It will has a endless loop between body.Close() and primaryReader.Close(),because both of them try to call the other one actually.
Yeah you are right... @thewangzl fix this problem is a little bit complex... let us discuss it, the problem is in SetBody
part. For now, please use candidatePools
, they works well.
I see.
It seems this problem has been solved during update of easegress 2.0. Please reopen it if you have any problem about it.