Skip to content

disk io error on arm64 system with 64KB pages

hi,I am using sqlite on an arm64 Linux machine. When the wal file exceeds 4096 pages, sqlite will report a disk io error. I checked and found that this is a problem caused by incorrect mmap parameters. In the case of 64KB page size, mmap is not aligned by page. During debugging, I saw that the _unixShmRegionPerMap function in sqlite/lib/sqlite_linux_arm64.go seems to be not working properly on arm64 machines. The result of pgsz is always 0. It seems to be a problem implemented in modernc.org/libc

func _unixShmRegionPerMap(tls *libc.TLS) (r int32) {

var pgsz, shmsz int32

_, _ = pgsz, shmsz shmsz = libc.Int32FromInt32(32) * libc.Int32FromInt32(1024) /* SHM region size */

pgsz = (*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(25)].FpCurrent})))(tls) /* System page size */

_ = libc.Int32FromInt32(0) /* Page size must be a power of 2 */

if pgsz < shmsz {

return int32(1)

}

return pgsz / shmsz }

Edited by @_@