Closed IMMORTALxJO closed 2 years ago
Hi!
I found some issue while using this package. Seems NewClient creation leads to goroutines leak. Could be reproduced on the simple request:
package main import ( "fmt" "runtime" "alexejk.io/go-xmlrpc" ) func request() { client, err := xmlrpc.NewClient("https://bugzilla.mozilla.org/xmlrpc.cgi") if err != nil { panic(err) } defer client.Close() result := &struct { BugzillaVersion struct { Version string } }{} _ = client.Call("Bugzilla.version", nil, result) fmt.Printf("Version: %s\n", result.BugzillaVersion.Version) } func main() { for i := 0; i < 10; i++ { request() fmt.Printf("NumGoroutine: %d\n", runtime.NumGoroutine()) } }
Output:
Version: 20220119.1 NumGoroutine: 3 Version: 20220119.1 NumGoroutine: 4 Version: 20220119.1 NumGoroutine: 5 Version: 20220119.1 NumGoroutine: 6 Version: 20220119.1 NumGoroutine: 7 Version: 20220119.1 NumGoroutine: 8 Version: 20220119.1 NumGoroutine: 10 Version: 20220119.1 NumGoroutine: 10 Version: 20220119.1 NumGoroutine: 11 Version: 20220119.1 NumGoroutine: 12
I tried to find the root cause myself, but have no results yet.
Thank you for reporting this. Apologies for a massive delay in looking into it (completely missed notification for this bug). Available in released version 0.3.0
Hi!
I found some issue while using this package. Seems NewClient creation leads to goroutines leak. Could be reproduced on the simple request:
Output:
I tried to find the root cause myself, but have no results yet.