Skip to content

fatal error: concurrent map read and map write #7

Description

@kingname

When I use goroutine, this line panic:

tr, _ := ja3transport.NewTransportWithConfig(browser.Ja3, &config)

the error msg is:

fatal error: concurrent map read and map write

goroutine 21 [running]:
runtime.throw(0x1358b57, 0x21)
        /usr/local/Cellar/go/1.16.3/libexec/src/runtime/panic.go:1117 +0x72 fp=0xc00004ec20 sp=0xc00004ebf0 pc=0x1036c92
runtime.mapaccess2_faststr(0x12fd980, 0xc00009ac90, 0xc0000ac979, 0x2, 0xc000080e18, 0xc000060101)
        /usr/local/Cellar/go/1.16.3/libexec/src/runtime/map_faststr.go:116 +0x4a5 fp=0xc00004ec90 sp=0xc00004ec20 pc=0x1015465
github.com/CUCyber/ja3transport.stringToSpec(0xc0000ac840, 0x153, 0x100f4b8, 0x170, 0x13497c0)
        /Users/kingname/go/pkg/mod/github.com/!c!u!cyber/ja3transport@v0.0.0-20201031204932-8a22ac8ab5d7/transport.go:152 +0x4db fp=0xc00004ee08 sp=0xc00004ec90 pc=0x12c897b
github.com/CUCyber/ja3transport.NewTransportWithConfig(0xc0000ac840, 0x153, 0xc000001680, 0x0, 0x0, 0x0)
        /Users/kingname/go/pkg/mod/github.com/!c!u!cyber/ja3transport@v0.0.0-20201031204932-8a22ac8ab5d7/transport.go:85 +0x39 fp=0xc00004ee50 sp=0xc00004ee08 pc=0x12c8399

it seems that there is a concurrent write on map at line 152 at transport.go:

image

The key reason is the global variable extMap:

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions