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

runtime: TestArenaCollision should be skipped when sysReserve cannot return an address based on the given hint #49415

Closed
hajimehoshi opened this issue Nov 6, 2021 · 5 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@hajimehoshi
Copy link
Member

hajimehoshi commented Nov 6, 2021

https://cs.opensource.google/go/go/+/master:src/runtime/export_test.go;l=495-509;drc=4f543b59c5618abccf0e78a17a2aeb173c085a91

func MapNextArenaHint() (start, end uintptr) {
	hint := mheap_.arenaHints
	addr := hint.addr
	if hint.down {
		start, end = addr-heapArenaBytes, addr
		addr -= physPageSize
	} else {
		start, end = addr, addr+heapArenaBytes
	}
	sysReserve(unsafe.Pointer(addr), physPageSize)
	return
}

MapNextArenaHint is a function for testing, and returns the addresses for an arena region. sysReserve might not use the given address in some special environments like Wasm or Plan9. MapNextArenaHint should return the actual allocated addresses, rather than the given addresses.

@hajimehoshi hajimehoshi changed the title runtime: MapNextArenaHint should return the actually allocated addresses instead of the preserved addresses runtime: MapNextArenaHint should return the actually allocated addresses instead of the hint addresses Nov 6, 2021
@hajimehoshi
Copy link
Member Author

@gopherbot
Copy link

Change https://golang.org/cl/361956 mentions this issue: runtime: fix MapNextArenaHint return actual addresses

@hajimehoshi
Copy link
Member Author

I started to think we should skip TestArenaCollision on Plan 9 and Wasm.

CC @aclements

@gopherbot
Copy link

Change https://golang.org/cl/361957 mentions this issue: runtime: skip TestArenaCollision when sysReserve returns nil

@ALTree ALTree added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Nov 7, 2021
@hajimehoshi hajimehoshi changed the title runtime: MapNextArenaHint should return the actually allocated addresses instead of the hint addresses runtime: TestArenaCollision should be skipped when sysReserve cannot return an address based on the given hint Nov 8, 2021
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
@seankhliao seankhliao added this to the Unplanned milestone Aug 20, 2022
@gopherbot
Copy link

Change https://go.dev/cl/446877 mentions this issue: runtime: skip TestArenaCollision on failed reservation

romaindoumenc pushed a commit to TroutSoftware/go that referenced this issue Nov 3, 2022
If TestArenaCollision cannot reserve the address range it expects to
reserve, it currently fails somewhat mysteriously. Detect this case
and skip the test. This could lead to test rot if we wind up always
skipping this test, but it's not clear that there's a better answer.
If the test does fail, we now also log what it thinks it reserved so
the failure message is more useful in debugging any issues.

Fixes golang#49415
Fixes golang#54597

Change-Id: I05cf27258c1c0a7a3ac8d147f36bf8890820d59b
Reviewed-on: https://go-review.googlesource.com/c/go/+/446877
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
@golang golang locked and limited conversation to collaborators Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants