coupergateway / couper

Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects
https://couper.io
MIT License
84 stars 15 forks source link

#766 fix proxy stream #787

Closed malud closed 9 months ago

malud commented 9 months ago

closes https://github.com/coupergateway/couper/issues/766

Reviewer checklist
  • Read PR description: a summary about the changes is required
  • Changelog updated
  • Documentation: docs/{Reference, Cli, ...}, Docker and cli help/usage
  • Pulled branch, manually tested
  • Verified requirements are met
  • Reviewed the code
  • Reviewed the related tests
johakoch commented 9 months ago

If I change the paths to

    paths := []string{
        "/named",
        "/named",
        "/named",
        "/named",
    }

(which doesn't have default request/proxy), TestBackend_MaxConnections_BodyClose passes 10/10.

If I change it to

    paths := []string{
        "/",
        "/",
        "/",
        "/",
    }

(which has default request), TestBackend_MaxConnections_BodyClose fails 8/10.

So I guess, this is related to the changes to the handling of default requests/proxies in this PR.

In Backend.innerRoundTrip(), all backend requests are passed to

    beresp, err := b.transport.RoundTrip(req)

but at least some get a "context canceled" error.

johakoch commented 9 months ago

The test started to fail with commit "Fix buffer condition and related body parse in combination with syncedVariables provided by each backend instance", then passed with commit "Fix random order related to the default block while preparing roundtrips" and failed again with commit "reduce produce wait-time; TODO".

Apparently, the

        time.Sleep(time.Nanosecond * 10) // TODO: refactor to ch pipe

is not stable enought. The previous

        time.Sleep(time.Millisecond * 5) // TODO: refactor to ch pipe

was more stable.