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

Fatal error when requesting multiple challenges at the same time for the same token #3

Open
aeyoll opened this issue Oct 17, 2023 · 0 comments · May be fixed by #4
Open

Fatal error when requesting multiple challenges at the same time for the same token #3

aeyoll opened this issue Oct 17, 2023 · 0 comments · May be fixed by #4

Comments

@aeyoll
Copy link

aeyoll commented Oct 17, 2023

Hello,

If I do the following:

curl -H "Authorization: Bearer 163b9d3cfab1ad8407a9e0f4bc984a81" -X POST "http://127.0.0.1:2370/GetChallenges?difficultyLevel=5" & curl -H "Authorization: Bearer 163b9d3cfab1ad8407a9e0f4bc984a81" -X POST "http://127.0.0.1:2370/GetChallenges?difficultyLevel=5"

It can result in a fatal error:

❯ ./pow-captcha
2023/10/17 11:15:43 💥  PoW! Captcha server listening on port 2370
fatal error: concurrent map writes
fatal error: concurrent map writes

goroutine 26 [running]:
runtime.throw(0x704aac, 0x15)
        /usr/lib/go-1.15/src/runtime/panic.go:1116 +0x72 fp=0xc0001ab878 sp=0xc0001ab848 pc=0x437272
runtime.mapassign_faststr(0x6b5ba0, 0xc000115140, 0xc0000276e0, 0x5c, 0xc000117c28)
        /usr/lib/go-1.15/src/runtime/map_faststr.go:291 +0x3d8 fp=0xc0001ab8e0 sp=0xc0001ab878 pc=0x415c58
main.main.func7(0x75e7e0, 0xc0001820e0, 0xc00055e000, 0x0)
        /tmp/pow-captcha/main.go:307 +0x510 fp=0xc0001abb20 sp=0xc0001ab8e0 pc=0x6847f0
main.myHTTPHandleFunc.func1(0x75e7e0, 0xc0001820e0, 0xc00055e000)
        /tmp/pow-captcha/main.go:430 +0x7a fp=0xc0001abb68 sp=0xc0001abb20 pc=0x6860da
net/http.HandlerFunc.ServeHTTP(0xc00012c400, 0x75e7e0, 0xc0001820e0, 0xc00055e000)                                                                                                                                                                    /usr/lib/go-1.15/src/net/http/server.go:2042 +0x44 fp=0xc0001abb90 sp=0xc0001abb68 pc=0x64b6c4
net/http.(*ServeMux).ServeHTTP(0x8e96a0, 0x75e7e0, 0xc0001820e0, 0xc00055e000)
        /usr/lib/go-1.15/src/net/http/server.go:2417 +0x1ad fp=0xc0001abbf0 sp=0xc0001abb90 pc=0x64d6ed
net/http.serverHandler.ServeHTTP(0xc000182000, 0x75e7e0, 0xc0001820e0, 0xc00055e000)
        /usr/lib/go-1.15/src/net/http/server.go:2843 +0xa3 fp=0xc0001abc20 sp=0xc0001abbf0 pc=0x64e663
net/http.(*conn).serve(0xc000138280, 0x75ed60, 0xc000558040)
        /usr/lib/go-1.15/src/net/http/server.go:1925 +0x8ad fp=0xc0001abfc8 sp=0xc0001abc20 pc=0x64a70d
runtime.goexit()
        /usr/lib/go-1.15/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc0001abfd0 sp=0xc0001abfc8 pc=0x46b7a1
created by net/http.(*Server).Serve
        /usr/lib/go-1.15/src/net/http/server.go:2969 +0x36c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant