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

with ulimit: throw: runtime: SysReserve returned unaligned address #2015

Closed
pebbe opened this issue Jun 28, 2011 · 3 comments
Closed

with ulimit: throw: runtime: SysReserve returned unaligned address #2015

pebbe opened this issue Jun 28, 2011 · 3 comments

Comments

@pebbe
Copy link
Contributor

pebbe commented Jun 28, 2011

Even the smallest program compiled with 8g segfaults when run under limited memory,
memory that should still be enough to allocate large amounts of memory by the program.

What steps will reproduce the problem?

(peter) ~/go cat hello.go 
package main

import "fmt"

func main() {
        fmt.Println("Hello, 世界")
}
(peter) ~/go 8g hello.go
(peter) ~/go 8l -o hello hello.8
(peter) ~/go ./hello 
Hello, 世界
(peter) ~/go ulimit -v 500000
(peter) ~/go ./hello 
throw: runtime: SysReserve returned unaligned address

Segmentation fault
(peter) ~/go 

What is the expected output?

Hello, 世界

What do you see instead?

throw: runtime: SysReserve returned unaligned address

Which compiler are you using (5g, 6g, 8g, gccgo)?

8g

Which operating system are you using?

i686 GNU/Linux

Which revision are you using?  (hg identify)

9d7967223815 (release-branch.r57) release/release.r57.2

Please provide any additional information below.

Running the program 'hello' compiled with Go release 56 gives a different error:

throw: runtime: cannot reserve arena virtual address space
Segmentation fault


Doing the same thing on Linux 64, with 'hello' compiled with 6g does not cause these
problems, not even with only a tenth of the value for ulimit. 

On Linux 32 (8g):
ulimit -v 800000  # program still runs
ulimit -v 700000  # segmentation fault

On Linux 64 (6g):
ulimit -v 40000   # program still runs.
ulimit -v 30000   # no segfault, but output: Killed
ulimit -v 10000   # other programs still run, like a small text editor
ulimit -v 9000    # other programs start failing with memory problems
@rsc
Copy link
Contributor

rsc commented Jun 28, 2011

Comment 1:

ulimit -v does not limit the amount of memory a
program can use.  It limits the amount of virtual
address space a program can use.
Go's memory allocator reserves a lot of virtual
address space, to simplify its implementation,
but it does not use it all for 'hello, world'.
I don't expect that to change.
I can't explain why 32-bit and 64-bit Linux are
behaving differently for you.

Status changed to WorkingAsIntended.

@rsc
Copy link
Contributor

rsc commented Jun 28, 2011

Comment 2:

"Intended" is perhaps too strong.

Status changed to Unfortunate.

@pebbe
Copy link
Contributor Author

pebbe commented Jun 29, 2011

Comment 3:

I tested it on another linux machine, also 386. I got the same results. Programs run
normally with ulimit -v 800000, and give segmentation fault with ulimit -v 700000.
On 32-bit linux, the programs needs 20 times the amount of virtual address space as on
64-bit linux. You say, you can't explain why. So the status of this issue should be
"unexplained", not "unfortunate".
On a web server running many complex processes, I use ulimit -v 500000, to prevent
misbehaving programs from bringing the web site down. That is why I noticed this thing
with Go.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants