Optional upstream?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 12.4k
- Forks
- 510
- PR merge metrics
- No merged PRs in 30d
Description
This might only make sense for the timeout toxic used with timeout=0, but wouldn't it be nice if it could work without a responding upstream?
I tried with a "dummy" upstream, just picking a port where nothing was listening
[
{
"name": "timeout_dummy",
"listen": "127.0.0.1:8080",
"upstream": "127.0.0.1:9999"
}
]
$ toxiproxy-cli toxic add timeout_dummy -t timeout -a timeout=0
Added downstream timeout toxic 'timeout_downstream' on proxy 'timeout_dummy'
But toxiproxy didn't like that
$ curl -o /dev/null -s -v -m 3 http://127.0.0.1:8080
* Rebuilt URL to: http://127.0.0.1:8080/
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.43.0
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
$ toxiproxy-server -config tmp/toxiproy.json
INFO[0000] Started proxy name=timeout_dummy proxy=127.0.0.1:8080 upstream=127.0.0.1:9999
INFO[0000] Populated proxies from file config=tmp/toxiproy.json proxies=1
INFO[0000] API HTTP server starting host=localhost port=8474 version=2.1.0
INFO[0004] Accepted client client=127.0.0.1:62301 name=timeout_dummy proxy=127.0.0.1:8080 upstream=127.0.0.1:9999
ERRO[0004] Unable to open connection to upstream client=127.0.0.1:62301 name=timeout_dummy proxy=127.0.0.1:8080 upstream=127.0.0.1:9999
I was actually able to workaround this by setting the upstream to toxiproxy itself ("upstream": "127.0.0.1:8474"):
$ toxiproxy-server -config tmp/toxiproy.json
INFO[0000] Started proxy name=timeout_dummy proxy=127.0.0.1:8080 upstream=127.0.0.1:8474
INFO[0000] Populated proxies from file config=tmp/toxiproy.json proxies=1
INFO[0000] API HTTP server starting host=localhost port=8474 version=2.1.0
INFO[0017] Accepted client client=127.0.0.1:62254 name=timeout_dummy proxy=127.0.0.1:8080 upstream=127.0.0.1:8474
WARN[0020] Source terminated bytes=176 err=read tcp 127.0.0.1:62255->127.0.0.1:8474: use of closed network connection name=timeout_dummy
$ curl -o /dev/null -s -v -m 3 http://127.0.0.1:8080
* Rebuilt URL to: http://127.0.0.1:8080/
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.43.0
> Accept: */*
>
* Operation timed out after 3002 milliseconds with 0 bytes received
* Closing connection 0
WDYT about the workaround, might be enough that that works?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the timeout toxic documentation and reproduce the reported timeout=0 behavior using the dummy upstream and the toxiproxy API port workaround. Trace how the proxy handles an unreachable upstream, then define and test the desired behavior for a timeout toxic that does not require a responding upstream.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100