FAQ
Does the Go runtime could be modified to auto-kill the process in case of
(a) to use more memory than [x] Mb or (b) if it takes too much time in run?

I'll wait until that the Go compiler be in Go (v1.4), but I want to know
about it.

Note: it is not for that it been included in the Go version official.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Aram Hăvărneanu at May 4, 2014 at 10:30 am
    The place for enforcing quotas is not in the Go runtime. Use your
    operating system's resource quota technology.

    Also, measuring memory consumption accurately is complex business,
    there's no such thing as "my program uses xMB of memory" in the world
    of virtual memory systems. You have to be very precise about what kind
    of questions you ask. Fortunately, the quota mechanisms allows for
    this fine grained caps.

    --
    Aram Hăvărneanu

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Archos at May 4, 2014 at 10:41 am

    On Sunday, May 4, 2014 11:30:05 AM UTC+1, Aram Hăvărneanu wrote:
    The place for enforcing quotas is not in the Go runtime. Use your
    operating system's resource quota technology.
    The issue is that I want a solution for all systems (where Go runs) and
    since I know, Windows --I'm not user of such sytem-- does not enables to
    limit resources like memory.

    Also, measuring memory consumption accurately is complex business,
    there's no such thing as "my program uses xMB of memory" in the world
    of virtual memory systems. You have to be very precise about what kind
    of questions you ask. Fortunately, the quota mechanisms allows for
    this fine grained caps.

    I simply want to limit the resources like if the Go compiler were a VM,
    for programs untrusted downloaded from Internet.
    Of course, I've in mind packages like syscall, functions of "os", etc, for
    that such programs can not damage the system where they are run.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Gyepi SAM at May 4, 2014 at 11:35 am

    On Sun, May 04, 2014 at 03:41:45AM -0700, Archos wrote:
    On Sunday, May 4, 2014 11:30:05 AM UTC+1, Aram Hăvărneanu wrote:

    The place for enforcing quotas is not in the Go runtime. Use your
    operating system's resource quota technology.
    The issue is that I want a solution for all systems (where Go runs) and
    since I know, Windows --I'm not user of such sytem-- does not enables to
    limit resources like memory.
    It's been a while, thankfully, since I had to deal with Windows, but it likely
    has this mechanism as well, just done differently.

    In general, I don't think it's useful to push features into a language because
    a target OS does not natively support that feature. Otherwise, the language
    turns into an OS ;)
    Also, measuring memory consumption accurately is complex business,
    there's no such thing as "my program uses xMB of memory" in the world
    of virtual memory systems. You have to be very precise about what kind
    of questions you ask. Fortunately, the quota mechanisms allows for
    this fine grained caps.

    I simply want to limit the resources like if the Go compiler were a VM,
    for programs untrusted downloaded from Internet.
    Of course, I've in mind packages like syscall, functions of "os", etc, for
    that such programs can not damage the system where they are run.
    The Go compiler is NOT like a VM and cannot be depended upon to limit damage
    caused by untrusted programs. You need a sandbox for that.

    I would review the code for play.golang.org (IIRC it's available somewhere).

    You'll find that you need an actual VM of some kind to do this effectively, which
    obviates the need for Windows compatibility and provides the level of control you need
    to implement it correctly.

    -Gyepi

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Archos at May 4, 2014 at 11:46 am

    On Sunday, May 4, 2014 12:35:00 PM UTC+1, Gyepi SAM wrote:
    On Sun, May 04, 2014 at 03:41:45AM -0700, Archos wrote:

    On Sunday, May 4, 2014 11:30:05 AM UTC+1, Aram Hăvărneanu wrote:
    Also, measuring memory consumption accurately is complex business,
    there's no such thing as "my program uses xMB of memory" in the world
    of virtual memory systems. You have to be very precise about what kind
    of questions you ask. Fortunately, the quota mechanisms allows for
    this fine grained caps.

    I simply want to limit the resources like if the Go compiler were a
    VM,
    for programs untrusted downloaded from Internet.
    Of course, I've in mind packages like syscall, functions of "os", etc, for
    that such programs can not damage the system where they are run.
    The Go compiler is NOT like a VM and cannot be depended upon to limit
    damage
    caused by untrusted programs. You need a sandbox for that.
    I mean the Go runtime, not the Go compiler. The runtime, among other
    things, control goroutines and get information of the system like number of
    CPUs, etc, so I don't see any problem to modify the runtime to do some
    checks.

    I would review the code for play.golang.org (IIRC it's available
    somewhere).

    You'll find that you need an actual VM of some kind to do this
    effectively, which
    obviates the need for Windows compatibility and provides the level of
    control you need
    to implement it correctly.
    Yep, using a VM is the thing that all people has used until now.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Dmitry Vyukov at May 4, 2014 at 11:50 am

    On Sun, May 4, 2014 at 11:26 AM, Archos wrote:
    Does the Go runtime could be modified to auto-kill the process in case of
    (a) to use more memory than [x] Mb or (b) if it takes too much time in run?

    I'll wait until that the Go compiler be in Go (v1.4), but I want to know
    about it.

    Note: it is not for that it been included in the Go version official.

    It's possible to do, but it will give you very weak guarantees
    (because a program can allocate memory bypassing runtime and it can
    run subprocesses). OS provided means are definitely more robust. For
    the execution time you definitely just want to setup a timer in the
    parent (your) process.

    To answer your question. For memory consumption you need to modify
    mem_GOOS.c files in runtime to check for total memory consumption
    after any allocations. For execution time you can start a separate
    goroutine that will kill the process after timeout, look at how
    scavenger goroutine is started within runtime.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 4, '14 at 10:26a
activeMay 4, '14 at 11:50a
posts6
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase