socket fd leaks if dial timeout occur
req, err := http.NewRequest("POST", s.url, buffer)
if err != nil {
return err
}
if s.auth != nil {
req.SetBasicAuth(s.auth.Login, s.auth.Password)
}
req.Header.Add("Content-Type", "text/xml; charset=\"utf-8\"")
req.Header.Add("SOAPAction", soapAction)
req.Header.Set("User-Agent", "gowsdl/0.1")
req.Close = true
tr := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: s.tls,
},
Dial: (&net.Dialer{
Timeout: 60 * time.Second,
KeepAlive: 10 * time.Second,
}).Dial,
TLSHandshakeTimeout: 5 * time.Second,
ResponseHeaderTimeout: 300 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
client := &http.Client{Transport: tr}
reliableClient := pester.NewExtendedClient(client)
res, err := reliableClient.Do(req)
if nil != res && nil != res.Body {
defer res.Body.Close()
}
if err != nil {
return err
}
If dial timeout occur, opened socket fd will leak. sudo lsof -n -a -p $(pidof processname) |grep "can't identify protocol" |wc -l You will see many 'can't identify protocol' socket.
Thanks for submitting this! I wont have time to dig in this week (PRs welcome!). I can try to dig in this weekend or the next, luck willing.
I've been moving across the country and am super bogged down. I've not forgotten about this, but I don't know when I can get to it. PRs welcome!
Can this still be reproduced? I experimented with dial timeouts on ubuntu today and couldn't reproduce leaked sockets.
To my knowledge, all leaks were patched a while back.
On Mon, Aug 10, 2020 at 8:50 AM Aleksandar Č. [email protected] wrote:
Can this still be reproduced? I experimented with dial timeouts on ubuntu today and couldn't reproduce leaked sockets.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/sethgrid/pester/issues/37*issuecomment-671402203__;Iw!!NCc8flgU!LtYYAX1YaPlf0Ajm5QM6GAG0CoUtSitnhQDwSnO0XVy1gH-MZioVHAJ4Cs2MZBpsKA$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AAHRU7FH5VT42X6RHDJUWMTSAACLFANCNFSM4FSD32OQ__;!!NCc8flgU!LtYYAX1YaPlf0Ajm5QM6GAG0CoUtSitnhQDwSnO0XVy1gH-MZioVHAJ4Cs2q1bXKJA$ .