Closed eclipseo closed 5 years ago
I am not sure why this is happening. Based on my testing, this issue appeared with Go 1.12. It seems related to memory mapping as the same test passes if I load the database into memory instead. It would be interesting to bisect Go to see which commit caused the issue.
The bisect of go
wasn't quite as bad as I imagined. The offending commit seems to be https://github.com/golang/go/commit/9a8372f8bd5a39d2476bfa9247407b51f9193b9e. I'll likely need to dig into this later as most of the changes are beyond me.
Aha, the real issue seems to be the use of runtime.SetFinalizer
. Using that was probably a bad decision on my part. I'll need to think about this a bit more.
This turned out to be fairly easy to fix. From the Go 1.12 release notes:
The compiler's live variable analysis has improved. This may mean that finalizers will be executed sooner in this release than in previous releases. If that is a problem, consider the appropriate addition of a runtime.KeepAlive call.
I added a runtime.KeepAlive
call to the Verify
method and that seemed to resolve the issue.
Golang 1.12.5, on Fedora Rawhide x86_64, maxminddb 1.3.0: