Conversation
The atomic package requires aligned variables (as per the package documentation), but this is not happening for the variables on the stack. Instead change the types for these to 32-bit variables as there should be no need to track 64-bit stats. This fixes various panics from the unaligned memory accesses.
|
Just coping the linked panic log just to keep it here |
I'm not sure if going 32 bit is good solution. I understand this may solve the problem but it's limiting the statistics maybe we should consider mutex and locking? We can use channel to and additional gorutine to make this asyc to not slow down Read/Write operations. |
https://golang.org/pkg/sync/atomic/#pkg-note-BUG
I pondered about the reduced tracking, but then questioned whether the code would be reaching 2147483648 hits/misses? |
The atomic package requires aligned variables (as per the package documentation), but this is not happening for the variables on the stack. Instead change the types for these to 32-bit variables as there should be no need to track 64-bit stats.
This fixes various panics from the unaligned memory accesses, such as the one seen at https://ci.debian.net/data/autopkgtest/testing/i386/g/golang-github-allegro-bigcache/9212366/log.gz.