Skip to content
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

Fix crashing under ARMv6 #239

Merged
merged 4 commits into from
Feb 15, 2021
Merged

Fix crashing under ARMv6 #239

merged 4 commits into from
Feb 15, 2021

Conversation

XIELongDragon
Copy link
Contributor

@XIELongDragon XIELongDragon commented Dec 27, 2020

ristretto will crash under ARM32. It is caused by the function goLoad64 at

https://golang.org/src/runtime/internal/atomic/atomic_arm.go line 129

//go:nosplit
func goLoad64(addr *uint64) uint64 {
	if uintptr(unsafe.Pointer(addr))&7 != 0 {
		*(*int)(nil) = 0 // crash on unaligned uint64
	}
	_ = *addr // if nil, fault before taking the lock
	var r uint64
	addrLock(addr).lock()
	r = *addr
	addrLock(addr).unlock()
	return r
}

The root cause is the sampledLFU unaligned


This change is Reviewable

@CLAassistant
Copy link

CLAassistant commented Dec 27, 2020

CLA assistant check
All committers have signed the CLA.

@XIELongDragon
Copy link
Contributor Author

goroutine 22 [running]:
runtime/internal/atomic.goLoad64(0x19b1744, 0x182bf9c, 0x3)
        /usr/local/go/src/runtime/internal/atomic/atomic_arm.go:131 +0x1c
github.com/dgraph-io/ristretto.(*sampledLFU).getMaxCost(...)
        /home/pi/neurons/vendor/github.com/dgraph-io/ristretto/policy.go:296
github.com/dgraph-io/ristretto.(*defaultPolicy).Add(0x19b1760, 0x3c60b443, 0x0, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/pi/neurons/vendor/github.com/dgraph-io/ristretto/policy.go:140 +0x80
github.com/dgraph-io/ristretto.(*Cache).processItems(0x191fc80)
        /home/pi/neurons/vendor/github.com/dgraph-io/ristretto/cache.go:435 +0x29c
created by github.com/dgraph-io/ristretto.NewCache
        /home/pi/neurons/vendor/github.com/dgraph-io/ristretto/cache.go:204 +0x32c

@XIELongDragon
Copy link
Contributor Author

@jarifibrahim @manishrjain can you review please ?

Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XIELongDragon
Copy link
Contributor Author

XIELongDragon commented Feb 12, 2021

@NamanJain8 NamanJain8 merged commit 9c8fa18 into dgraph-io:master Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants