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

[Bug]: concurrent map read and map write #148

Closed
divyam234 opened this issue Dec 8, 2024 · 0 comments
Closed

[Bug]: concurrent map read and map write #148

divyam234 opened this issue Dec 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@divyam234
Copy link

TLS client version

1.3

System information

Linux

Issue description

fatal error: concurrent map read and map write

goroutine 71 [running]:
net/textproto.MIMEHeader.Get(0xc00027cc60, {0x111f76e, 0xf})
	/usr/local/go/src/net/textproto/header.go:34 +0x6d
github.com/bogdanfinn/fhttp.Header.Get(0xc00027cc60, {0x111f76e, 0xf})
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/header.go:74 +0x37
github.com/bogdanfinn/fhttp.(*persistConn).roundTrip(0xc0004cc360, 0xc000056080)
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/transport.go:2551 +0x1f8
github.com/bogdanfinn/fhttp.(*Transport).roundTrip(0xc0001cc2c0, 0xc0000da100)
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/transport.go:596 +0xe25
github.com/bogdanfinn/fhttp.(*Transport).RoundTrip(0xc0001cc2c0, 0xc0000da100)
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/roundtrip.go:17 +0x49
github.com/bogdanfinn/tls-client.(*roundTripper).RoundTrip(0xc0001d1540, 0xc0000da100)
	/root/go/pkg/mod/github.com/bogdanfinn/tls-client@v1.7.10/roundtripper.go:93 +0x274
github.com/bogdanfinn/fhttp.send(0xc0000da000, {0x11f5c40, 0xc0001d1540}, {0xc1cd96c0cfce2888, 0xe03ebbf8d, 0x1784280})
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/client.go:251 +0x52a
github.com/bogdanfinn/fhttp.(*Client).send(0xc0001c2628, 0xc0000da000, {0xc1cd96c0cfce2888, 0xe03ebbf8d, 0x1784280})
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/client.go:175 +0x15a
github.com/bogdanfinn/fhttp.(*Client).do(0xc0001c2628, 0xc0000da000)
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/client.go:710 +0x12d7
github.com/bogdanfinn/fhttp.(*Client).Do(0xc0001c2628, 0xc0000da000)
	/root/go/pkg/mod/github.com/bogdanfinn/fhttp@v0.5.30/client.go:574 +0x49
github.com/bogdanfinn/tls-client.(*httpClient).Do(0xc0001c2600, 0xc0000da000)
	/root/go/pkg/mod/github.com/bogdanfinn/tls-client@v1.7.10/client.go:349 +0x9b2

Steps to reproduce / Code Sample

call same instance of tls client in multiple go routines

options := []tls_client.HttpClientOption{
		tls_client.WithRandomTLSExtensionOrder(),
		tls_client.WithClientProfile(profiles.Firefox_133),
		tls_client.WithForceHttp1(),
		tls_client.WithTimeoutSeconds(scrapeTimeout),
		tls_client.WithCookieJar(tls_client.NewCookieJar()),
		tls_client.WithCustomRedirectFunc(func(req *http.Request, via []*http.Request) error {
			if len(via) >= maxRedirects {
				return fmt.Errorf("%w: gave up after %d redirects", ErrMaxRedirects, maxRedirects)
			}
			return nil
		}),
	}
	defaultHeaders := http.Header{}
	defaultHeaders.Append("User-Agent", defaultUserAgent)
	defaultHeaders.Append("Accept-Language", "en-US,en;q=0.9")
	options = append(options, tls_client.WithDefaultHeaders(defaultHeaders))
	client, err := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...)
	```
	Client settings used
@divyam234 divyam234 added the bug Something isn't working label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant