-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: running Go code on OpenBSD gomote fails when not running as root #35568
Comments
If I were to guess, there's an |
For root bash's |
@ianlancetaylor I investigated this with someone who knows OpenBSD a bit. The number that's checked in the kernel from a Perhaps there's a workaround here but I need to give it some thought. It's a little bit weird to me that a |
Just a note that the same problem still happens on OpenBSD 6.4. |
/cc @mdempsky as FYI just because he likes OpenBSD issues. |
It's been a while since I've looked at OpenBSD's mmap implementation. I seem to recall it took the stance that PROT_NONE mappings still mapped data (and thus counts towards RLIMIT_DATA), just without read/write access. I see that http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/go/Makefile?rev=1.75 uses /cc @4a6f656c |
Change https://golang.org/cl/207497 mentions this issue: |
Currently the page allocator bitmap is implemented as a single giant memory mapping which is reserved at init time and committed as needed. This causes problems on systems that don't handle large uncommitted mappings well, or institute low virtual address space defaults as a memory limiting mechanism. This change modifies the implementation of the page allocator bitmap away from a directly-mapped set of bytes to a sparse array in same vein as mheap.arenas. This will hurt performance a little but the biggest gains are from the lockless allocation possible with the page allocator, so the impact of this extra layer of indirection should be minimal. In fact, this is exactly what we see: https://perf.golang.org/search?q=upload:20191125.5 This reduces the amount of mapped (PROT_NONE) memory needed on systems with 48-bit address spaces to ~600 MiB down from almost 9 GiB. The bulk of this remaining memory is used by the summaries. Go processes with 32-bit address spaces now always commit to 128 KiB of memory for the bitmap. Previously it would only commit the pages in the bitmap which represented the range of addresses (lowest address to highest address, even if there are unused regions in that range) used by the heap. Updates #35568. Updates #35451. Change-Id: I0ff10380156568642b80c366001eefd0a4e6c762 Reviewed-on: https://go-review.googlesource.com/c/go/+/207497 Run-TryBot: Michael Knyszek <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Austin Clements <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
The login class will be the reason why the allocation worked when run as root, but not when run as a normal user. However, even when a user has The same failure could also be triggered under Linux via Obviously this was a pretty significant regression from Go 1.13 - I can confirm that with the sparse array change, I can once again build Go with a data size limit of 2GB (although there appears to have been another regression with the memory requirements for compiling |
@mknyszek Is there anything else to do on this issue or do we think that it is fixed? |
@4a6f656c It's unfortunate that virtual address space is limited in this way, but c'est l'vie. I'm glad the sparse array change helped. We were also aware of @ianlancetaylor I don't think there's anything else we want to do now in terms of reducing |
I don't know what is going on here, but recording since something is wrong.
When I use
gomote run
with the openbsd-amd64-62 gomote, everything works as expected. When I usegomote ssh
to ssh into the gomote, the go tool consistently fails with the following stack trace.The only obvious difference is that
gomote run
runs as root butgomote ssh
does not.CC @mknyszek @aclements @bradfitz
The text was updated successfully, but these errors were encountered: