Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client.Do never returns on browsers (GOOS=js, GOARCH=wasm) #166

Open
hajimehoshi opened this issue May 6, 2022 · 0 comments
Open

Client.Do never returns on browsers (GOOS=js, GOARCH=wasm) #166

hajimehoshi opened this issue May 6, 2022 · 0 comments

Comments

@hajimehoshi
Copy link

hajimehoshi commented May 6, 2022

package main

import (
        "net/http"
        "time"

        "github.com/hashicorp/go-retryablehttp"
)

func main() {
        c := retryablehttp.NewClient()
        c.RetryWaitMax = time.Minute
        c.RetryMax = 1e9
        req, err := retryablehttp.NewRequest(http.MethodGet, "http://google.com", nil)
        if err != nil {
                panic(err)
        }
        res, err := c.Do(req)
        if err != nil {
                panic(err)
        }
        _ = res
}
  1. Run the above code on browsers with GOOS=js and GOARCH=wasm (I use my own wasmserve and Chrome to test this)
  2. See the log in Chrome's devtool

Retrying never ends like this:

2022/05/06 12:37:55 [DEBUG] GET http://google.com
wasm_exec.js:22 2022/05/06 12:37:55 [ERR] GET http://google.com request failed: Get "http://google.com": dial tcp: lookup google.com: Protocol not available
wasm_exec.js:22 2022/05/06 12:37:55 [DEBUG] GET http://google.com: retrying in 1s (1000000000 left)
wasm_exec.js:22 2022/05/06 12:37:56 [ERR] GET http://google.com request failed: Get "http://google.com": dial tcp: lookup google.com: Protocol not available
wasm_exec.js:22 2022/05/06 12:37:56 [DEBUG] GET http://google.com: retrying in 2s (999999999 left)
wasm_exec.js:22 2022/05/06 12:37:58 [ERR] GET http://google.com request failed: Get "http://google.com": dial tcp: lookup google.com: Protocol not available
wasm_exec.js:22 2022/05/06 12:37:58 [DEBUG] GET http://google.com: retrying in 4s (999999998 left)
wasm_exec.js:22 2022/05/06 12:38:02 [ERR] GET http://google.com request failed: Get "http://google.com": dial tcp: lookup google.com: Protocol not available
wasm_exec.js:22 2022/05/06 12:38:02 [DEBUG] GET http://google.com: retrying in 8s (999999997 left)
wasm_exec.js:22 2022/05/06 12:38:11 [ERR] GET http://google.com request failed: Get "http://google.com": dial tcp: lookup google.com: Protocol not available
wasm_exec.js:22 2022/05/06 12:38:11 [DEBUG] GET http://google.com: retrying in 16s (999999996 left)
wasm_exec.js:22 2022/05/06 12:38:29 [ERR] GET http://google.com request failed: Get "http://google.com": dial tcp: lookup google.com: Protocol not available

go-retryablehttp version: v0.7.1
Go version: go1.18 darwin/amd64
Chrome version: 101.0.4951.54 (Official Build) (x86_64)

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant