-
Notifications
You must be signed in to change notification settings - Fork 170
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
tsl_client transport not has timeout #33
Comments
Yeah, I think I found the same problem. Was testing a proxy which uses this library:
There are many goroutines which keep running and consume server resources: They are closed in 10m or so however. Is there a way to decrease this period? 🤔 |
@bogdanfinn
If the changes seem reasonable for you, I could create prs |
Sure, I think the following should be enough. This example opens 15 https urls (http works fine): package main
import (
"fmt"
"net/http"
_ "net/http/pprof"
fhttp "github.com/bogdanfinn/fhttp"
tls_client "github.com/bogdanfinn/tls-client"
)
var urls = []string{
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/0ad-data-0.0.25b-bp154.1.17.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/2ping-4.5.1-bp154.1.28.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/4pane-lang-7.0-bp154.1.87.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/AppStream-lang-0.15.1-150400.1.5.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/Botan-doc-2.18.2-bp154.1.30.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/CSXCAD-matlab-0.6.2-bp154.2.22.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/ClusterTools2-3.1.2-150100.8.9.1.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/Crystalcursors-0.5-bp154.1.22.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/DVDStyler-lang-3.1.2-bp154.1.53.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/FlightGear-data-2020.3.11-bp154.1.14.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/FlightGear-docs-2020.3.11-bp154.1.14.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/GeoIP-data-1.6.12-6.3.1.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/ImageMagick-doc-7.1.0.9-150400.4.7.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/J7Z-1.4.2-bp154.1.48.noarch.rpm",
"https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/J7Z-kf5-1.4.2-bp154.1.48.noarch.rpm",
}
func main() {
for _, item := range urls {
client, _ := tls_client.NewHttpClient(tls_client.NewNoopLogger())
freq, _ := fhttp.NewRequest("GET", item, nil)
resp, _ := client.Do(freq)
fmt.Println(item, resp.Status)
resp.Body.Close()
}
http.ListenAndServe("localhost:6060", nil)
} The example setups pprof endpoint on 6060. You can see hanging goroutines here http://127.0.0.1:6060/debug/pprof/goroutine?debug=1 Doing something like |
Added just on comment on your changeset. Let me know what you think about it. Then you can create prs if you like :-) |
Oh I see that you already have everything in order here e7f07b8 I think it might be simpler for both of us if you just use this commit :) Updating module dependencies is no fun! :D |
@jsnjack i was using your suggested fix yesterday to reproduce and debug this issue yes. i will implement your comment you wrote on my commit and then create a new public version then. |
Thanks! |
mabe hangup to
The text was updated successfully, but these errors were encountered: