-
Notifications
You must be signed in to change notification settings - Fork 91
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
Race condition in getQuery #26
Labels
Comments
It is an open project, You can submit a PR anytime. |
|
I'm take this, as i already have fix internally. |
zhengchun
added a commit
that referenced
this issue
Dec 23, 2019
Closed. It fixed in Release 1.2.2. |
zhengchun
added a commit
that referenced
this issue
Jan 13, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
i have a project in which multiple go routines parse xml files in parallel.
Today i got the following crash:
fatal error: concurrent map read and map write
goroutine 509 [running]:
runtime.throw(0xaf97d6, 0x21)
/usr/lib/go-1.13/src/runtime/panic.go:774 +0x72 fp=0xc004fb9678 sp=0xc004fb9648 pc=0x446712
runtime.mapaccess2(0xa20ec0, 0xc000299a10, 0xc004fb96e8, 0xc0002afef8, 0xc0002f68d8)
/usr/lib/go-1.13/src/runtime/map.go:470 +0x278 fp=0xc004fb96c0 sp=0xc004fb9678 pc=0x4255c8
github.com/golang/groupcache/lru.(*Cache).Get(0xc003a7b640, 0x9fa140, 0xc004fb9740, 0xc0002f68d8, 0xc0034b6200, 0x390000c004774720)
/root/go/pkg/mod/github.com/golang/[email protected]/lru/lru.go:78 +0x68 fp=0xc004fb9708 sp=0xc004fb96c0 pc=0x8d88a8
github.com/antchfx/xmlquery.getQuery(0xc0000248e0, 0x20, 0x11d3ef0, 0x0, 0xc0002afee0)
/root/go/pkg/mod/github.com/antchfx/[email protected]/cache.go:30 +0xbd fp=0xc004fb9760 sp=0xc004fb9708 pc=0x91359d
github.com/antchfx/xmlquery.Query(0xc00017cc00, 0xc0000248e0, 0x20, 0xc0034b6200, 0x0, 0xc0000248a0)
/root/go/pkg/mod/github.com/antchfx/[email protected]/query.go:103 +0x39 fp=0xc004fb9798 sp=0xc004fb9760 pc=0x9162e9
github.com/antchfx/xmlquery.FindOne(...)
/root/go/pkg/mod/github.com/antchfx/[email protected]/query.go:83
In findOne there is a package variable for the not thread save groupace/lru and since i use xmlqery concurrently the whole thing can crash here.
It is possible to disable the cache but i am not sure how much this would impact performance.
I guess that adding a mutex here would not impact performance as much as disabling the cache completely.
Should i write a pr for this?
Best regards
Sebastian
The text was updated successfully, but these errors were encountered: