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

Data racing #433

Open
AntonYurchenko opened this issue Jan 21, 2022 · 3 comments
Open

Data racing #433

AntonYurchenko opened this issue Jan 21, 2022 · 3 comments
Labels
needs triage Ticket that needs triage (a proper look for classification)

Comments

@AntonYurchenko
Copy link

Describe the bug

Data racing has in this package.

To Reproduce

This is my main.go:

package main

import (
	"crypto/tls"
	"fmt"
	"net/http"

	"github.com/andygrunwald/go-jira"
)

func main() {

	tp := jira.BasicAuthTransport{
		Username:  "my_login",
		Password:  "my_password",
		Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
	}

	client, err := jira.NewClient(tp.Client(), "https://jira.host.ru/")
	if err != nil {
		panic(err)
	}

	jql := "my_jql_query_here"

	result, resp, err := client.Issue.Search(jql, &jira.SearchOptions{})
	if err != nil {
		panic(err)
	}
	if resp.StatusCode != 200 {
		panic("Not 200 response")
	}

	fmt.Println("count:", len(result))

}

Start in terminal:

go run ./
count: 17

Start in terminal with enable data race detection:

go run -race ./
objc[93412]: Attempt to use unknown class 0x7ff851c57260.
SIGABRT: abort
PC=0x7ff81040fdfe m=0 sigcode=0

goroutine 0 [idle]:
runtime: unknown pc 0x7ff81040fdfe
stack: frame={sp:0x7ff7bfefe648, fp:0x0} stack=[0x7ff7bfe806d8,0x7ff7bfeff740)
00007ff7bfefe548:  0000000000000002  0000000000000002 
00007ff7bfefe558:  00000000021c7000  00000000021c7400 
00007ff7bfefe568:  0000000000000006  00007ff7bfefe5d0 
00007ff7bfefe578:  00007ff810245619  0000000000000000 
00007ff7bfefe588:  f6b58000c0001006  000000000000ffff 
00007ff7bfefe598:  0000000000000030  0000000000000000 
00007ff7bfefe5a8:  000000000000002d  000000000000002d 
00007ff7bfefe5b8:  0000000000000000  00000000021c7000 
00007ff7bfefe5c8:  00007ff851c6b000  00007ff7bfefe600 
00007ff7bfefe5d8:  00007ff810245546  00007ff81024550e 
00007ff7bfefe5e8:  000000000000002d  0000000000000001 
00007ff7bfefe5f8:  00007ff851c6b000  00007ff7bfefe640 
00007ff7bfefe608:  00007ff810261ad6  000000000000002c 
00007ff7bfefe618:  000000000000002d  0000600003300000 
00007ff7bfefe628:  0000000000000003  0000600002c00000 
00007ff7bfefe638:  0000000000000000  00007ff7bfefe670 
00007ff7bfefe648: <00007ff810411893  0000000000000000 
00007ff7bfefe658:  00000020bfefe6b0  0000600002c00000 
00007ff7bfefe668:  00007ff7bfefe6b0  0000600003300000 
00007ff7bfefe678:  0000000000000003  0000000000000080 
00007ff7bfefe688:  0000000000000001  00007ff7bfefe6a0 
00007ff7bfefe698:  00007ff810411843  00007ff7bfefe6e0 
00007ff7bfefe6a8:  00007ff8102ddbce  0000600002c00080 
00007ff7bfefe6b8:  0000000008c2b033  0000600002c00000 
00007ff7bfefe6c8:  00007ffffffffff8  00007ff851c57260 
00007ff7bfefe6d8:  0000000080080001  00007ff7bfefe7c0 
00007ff7bfefe6e8:  00007ff8102ddb5c  0000003000000010 
00007ff7bfefe6f8:  00007ff7bfefe7d0  00007ff7bfefe710 
00007ff7bfefe708:  00007ff89b0b1b30  00007ff89b0bb4c8 
00007ff7bfefe718:  00007ff851c57260  00007ff851c57260 
00007ff7bfefe728:  0000000000000001  00000000ffffffff 
00007ff7bfefe738:  0000000000000000  00007ff89b0b1e58 
runtime: unknown pc 0x7ff81040fdfe
stack: frame={sp:0x7ff7bfefe648, fp:0x0} stack=[0x7ff7bfe806d8,0x7ff7bfeff740)
00007ff7bfefe548:  0000000000000002  0000000000000002 
00007ff7bfefe558:  00000000021c7000  00000000021c7400 
00007ff7bfefe568:  0000000000000006  00007ff7bfefe5d0 
00007ff7bfefe578:  00007ff810245619  0000000000000000 
00007ff7bfefe588:  f6b58000c0001006  000000000000ffff 
00007ff7bfefe598:  0000000000000030  0000000000000000 
00007ff7bfefe5a8:  000000000000002d  000000000000002d 
00007ff7bfefe5b8:  0000000000000000  00000000021c7000 
00007ff7bfefe5c8:  00007ff851c6b000  00007ff7bfefe600 
00007ff7bfefe5d8:  00007ff810245546  00007ff81024550e 
00007ff7bfefe5e8:  000000000000002d  0000000000000001 
00007ff7bfefe5f8:  00007ff851c6b000  00007ff7bfefe640 
00007ff7bfefe608:  00007ff810261ad6  000000000000002c 
00007ff7bfefe618:  000000000000002d  0000600003300000 
00007ff7bfefe628:  0000000000000003  0000600002c00000 
00007ff7bfefe638:  0000000000000000  00007ff7bfefe670 
00007ff7bfefe648: <00007ff810411893  0000000000000000 
00007ff7bfefe658:  00000020bfefe6b0  0000600002c00000 
00007ff7bfefe668:  00007ff7bfefe6b0  0000600003300000 
00007ff7bfefe678:  0000000000000003  0000000000000080 
00007ff7bfefe688:  0000000000000001  00007ff7bfefe6a0 
00007ff7bfefe698:  00007ff810411843  00007ff7bfefe6e0 
00007ff7bfefe6a8:  00007ff8102ddbce  0000600002c00080 
00007ff7bfefe6b8:  0000000008c2b033  0000600002c00000 
00007ff7bfefe6c8:  00007ffffffffff8  00007ff851c57260 
00007ff7bfefe6d8:  0000000080080001  00007ff7bfefe7c0 
00007ff7bfefe6e8:  00007ff8102ddb5c  0000003000000010 
00007ff7bfefe6f8:  00007ff7bfefe7d0  00007ff7bfefe710 
00007ff7bfefe708:  00007ff89b0b1b30  00007ff89b0bb4c8 
00007ff7bfefe718:  00007ff851c57260  00007ff851c57260 
00007ff7bfefe728:  0000000000000001  00000000ffffffff 
00007ff7bfefe738:  0000000000000000  00007ff89b0b1e58 

goroutine 6 [syscall]:
runtime.cgocall(0x1001800, 0xc00005ece0, 0xc0000100e0)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/runtime/cgocall.go:133 +0x7a fp=0xc00005ecb0 sp=0xc00005ec78 pc=0x104547a
net._C2func_getaddrinfo(0xc000018340, 0x0, 0xc00007af60, 0xc0000100e0, 0xc000000000, 0x0, 0x0)
        _cgo_gotypes.go:100 +0x73 fp=0xc00005ece0 sp=0xc00005ecb0 pc=0x126faf3
net.cgoLookupIPCNAME.func1(0xc000018340, 0x11, 0x11, 0xc00007af60, 0xc0000100e0, 0xc00004b5f8, 0x12728bf, 0x1507420)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/cgo_unix.go:161 +0xd3 fp=0xc00005ed40 sp=0xc00005ece0 pc=0x1274d13
net.cgoLookupIPCNAME(0x1495658, 0x3, 0xc000018300, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/cgo_unix.go:161 +0x259 fp=0xc00005ef18 sp=0xc00005ed40 pc=0x1271439
net.cgoIPLookup(0xc000026540, 0x1495658, 0x3, 0xc000018300, 0x10)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/cgo_unix.go:218 +0x7d fp=0xc00005efb8 sp=0xc00005ef18 pc=0x1271f1d
runtime.goexit()
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc00005efc0 sp=0xc00005efb8 pc=0x10ad4c1
created by net.cgoLookupIP
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/cgo_unix.go:228 +0xde

goroutine 1 [select]:
net/http.(*Transport).getConn(0xc00013c280, 0xc00012c280, 0x0, 0xc00001e140, 0x5, 0xc000018300, 0x14, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/transport.go:1350 +0x9be
net/http.(*Transport).roundTrip(0xc00013c280, 0xc000150100, 0xc0000160f0, 0xc00013a780, 0xc000012de0)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/transport.go:569 +0xaed
net/http.(*Transport).RoundTrip(0xc00013c280, 0xc000150100, 0x8, 0x1496f6b, 0xb)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/roundtrip.go:17 +0x47
github.com/andygrunwald/go-jira.(*BasicAuthTransport).RoundTrip(0xc00007acc0, 0xc000150000, 0xc00007acc0, 0x0, 0x0)
        /Users/user/go/pkg/mod/github.com/andygrunwald/[email protected]/jira.go:366 +0x109
net/http.send(0xc000150000, 0x15023e0, 0xc00007acc0, 0x0, 0x0, 0x0, 0x108f2c0, 0x0, 0xc00010d5d0, 0x108f4a5)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/client.go:252 +0x6db
net/http.(*Client).send(0xc00007acf0, 0xc000150000, 0x0, 0x0, 0x0, 0xc0000100c8, 0x0, 0x1, 0x149793d)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/client.go:176 +0x1d6
net/http.(*Client).do(0xc00007acf0, 0xc000150000, 0x0, 0x0, 0x0)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/client.go:718 +0x2d8
net/http.(*Client).Do(0xc00007acf0, 0xc000150000, 0x0, 0xc00007adb0, 0x30)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/client.go:586 +0x47
github.com/andygrunwald/go-jira.(*Client).Do(0xc00014e000, 0xc000150000, 0x1424b40, 0xc00007adb0, 0x0, 0x0, 0x0)
        /Users/user/go/pkg/mod/github.com/andygrunwald/[email protected]/jira.go:277 +0x95
github.com/andygrunwald/go-jira.(*IssueService).SearchWithContext(0xc000010028, 0x1507460, 0xc0000140c0, 0x1497ac3, 0xd, 0xc00010df30, 0xc000010048, 0xc00014e040, 0xc000010040, 0xc00014e038, ...)
        /Users/user/go/pkg/mod/github.com/andygrunwald/[email protected]/issue.go:1096 +0x27f
github.com/andygrunwald/go-jira.(*IssueService).Search(0xc000010028, 0x1497ac3, 0xd, 0xc00010df30, 0xc00014e000, 0x0, 0x0, 0x14959ec, 0x5, 0x14ad2a0)
        /Users/user/go/pkg/mod/github.com/andygrunwald/[email protected]/issue.go:1105 +0xa5
main.main()
        /Users/user/sandbox/go-jira/main.go:26 +0x385

goroutine 4 [select]:
net.(*Resolver).lookupIPAddr(0x16daae0, 0x1507460, 0xc0000140c0, 0x1495658, 0x3, 0xc000018300, 0x10, 0x1bb, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/lookup.go:299 +0x8cc
net.(*Resolver).internetAddrList(0x16daae0, 0x1507460, 0xc0000140c0, 0x1495658, 0x3, 0xc000018300, 0x14, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/ipsock.go:280 +0x6dc
net.(*Resolver).resolveAddrList(0x16daae0, 0x1507460, 0xc0000140c0, 0x14957c9, 0x4, 0x1495658, 0x3, 0xc000018300, 0x14, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/dial.go:221 +0x5af
net.(*Dialer).DialContext(0x16db0a0, 0x1507460, 0xc0000140c0, 0x1495658, 0x3, 0xc000018300, 0x14, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/dial.go:403 +0x319
net/http.(*Transport).dial(0xc00013c280, 0x1507460, 0xc0000140c0, 0x1495658, 0x3, 0xc000018300, 0x14, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/transport.go:1153 +0x249
net/http.(*Transport).dialConn(0xc00013c280, 0x1507460, 0xc0000140c0, 0x0, 0xc00001e140, 0x5, 0xc000018300, 0x14, 0x0, 0xc000120b40, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/transport.go:1582 +0x2b7f
net/http.(*Transport).dialConnFor(0xc00013c280, 0xc0001302c0)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/transport.go:1424 +0x152
created by net/http.(*Transport).queueForDial
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/http/transport.go:1393 +0x6b0

goroutine 5 [select]:
net.cgoLookupIP(0x1507420, 0xc00012c2c0, 0x1495658, 0x3, 0xc000018300, 0x10, 0x0, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/cgo_unix.go:229 +0x1e9
net.(*Resolver).lookupIP(0x16daae0, 0x1507420, 0xc00012c2c0, 0x1495658, 0x3, 0xc000018300, 0x10, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/lookup_unix.go:96 +0x217
net.glob..func1(0x1507420, 0xc00012c2c0, 0xc000012e20, 0x1495658, 0x3, 0xc000018300, 0x10, 0x0, 0x0, 0x0, ...)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/hook.go:23 +0x9f
net.(*Resolver).lookupIPAddr.func1(0x0, 0x0, 0x0, 0x0)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/net/lookup.go:293 +0x162
internal/singleflight.(*Group).doCall(0x16daaf0, 0xc0000781e0, 0xc000018320, 0x14, 0xc00012c300)
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/internal/singleflight/singleflight.go:95 +0x52
created by internal/singleflight.(*Group).DoChan
        /usr/local/Cellar/[email protected]/1.15.15/libexec/src/internal/singleflight/singleflight.go:88 +0x4be

rax    0x2000209
rbx    0x80
rcx    0x7ff7bfefe648
rdx    0x0
rdi    0x8
rsi    0x1
rbp    0x7ff7bfefe690
rsp    0x7ff7bfefe648
r8     0x600002c00000
r9     0x80
r10    0x0
r11    0x246
r12    0x0
r13    0x0
r14    0x1
r15    0x8
rip    0x7ff81040fdfe
rflags 0x246
cs     0x7
fs     0x0
gs     0x0
exit status 2

Expected behavior

Start application with key-race should not throw panic.

Possible Solution

Maybe you unsafe use one variable from different goroutines?

Your Environment

Include as many relevant details about the environment you experienced the problem in

  • go-jira version (git tag or sha): require github.com/andygrunwald/go-jira v1.14.0
  • Go version (go version): go1.15.15 darwin/amd64
  • Jira version: v8.5.17#805017-sha1:5dff05e:jiranode8dbz
  • Jira type (cloud or on-premise): on-premise
  • Involved Jira plugins: I don`t have information about plugins
  • Operating System and version: Mac OS Monterey, version 12.1 (21C52)

Additional context

I think this behavior can cause incorrect data to be received on request from Jira API.

@github-actions
Copy link

Hi! Thank you for taking the time to create your first issue! Really cool to see you here for the first time. Please give us a bit of time to review it.

@benjivesterby
Copy link
Collaborator

@AntonYurchenko can you please upgrade to Go 1.17.6 and let me know if this is still an issue?

@andygrunwald andygrunwald added the needs triage Ticket that needs triage (a proper look for classification) label Aug 20, 2022
@andygrunwald
Copy link
Owner

Hey,

I am very sorry that this issue has been open for a long time with no final solution. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.

However, there is news: We are kicking off v2 of this library 🚀

To provide visibility, we created the Road to v2 Milestone and calling for your feedback in #489

The development will take some time; however, I hope you can benefit from the changes.
If you seek priority development for your issue + you like to sponsor it, please contact me.

What does this mean for my issue?

We will work on this issue indirectly.
This means that during the development phase, we aim to tackle it.
Maybe in a different way like it is currently handled.
Please understand that this will take a while because we are running this in our spare time.

Final words

Thanks for using this library.
If there is anything else you would like to tell us, let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Ticket that needs triage (a proper look for classification)
Projects
None yet
Development

No branches or pull requests

3 participants