FAQ
Occasionally I will do something silly and crash with error messages like
this:

panic: runtime error: index out of range



goroutine 1 [syscall]:

syscall.Syscall()

     /usr/lib64/golang/src/pkg/syscall/asm_linux_amd64.s:16 +0x5

That is the message in its entirety. Upon further debugging with liberal
print calls,
I can find the source of the errors, but what I don't understand is why the
stack
trace only includes this low level call and not my own calls which caused
the panic.
Shouldn't the stack trace include...well the trace? What am I doing wrong
here?

--
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/groups/opt_out.

Search Discussions

  • Ian Lance Taylor at Jan 24, 2014 at 2:42 pm

    On Fri, Jan 24, 2014 at 12:07 AM, wrote:
    Occasionally I will do something silly and crash with error messages like
    this:

    panic: runtime error: index out of range

    goroutine 1 [syscall]:
    syscall.Syscall()
    /usr/lib64/golang/src/pkg/syscall/asm_linux_amd64.s:16 +0x5

    That is the message in its entirety. Upon further debugging with liberal
    print calls,
    I can find the source of the errors, but what I don't understand is why the
    stack
    trace only includes this low level call and not my own calls which caused
    the panic.
    Shouldn't the stack trace include...well the trace? What am I doing wrong
    here?
    Yes, I would expect the stack trace to show more. Without more
    information it's hard to know what is going wrong. One thing you can
    try is setting the environment variable GOTRACEBACK to 2 when running
    the program.

    Ian

    --
    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/groups/opt_out.
  • Jefflund at Jan 24, 2014 at 4:38 pm

    On Friday, January 24, 2014 7:42:36 AM UTC-7, Ian Lance Taylor wrote:
    On Fri, Jan 24, 2014 at 12:07 AM, <jeff...@gmail.com <javascript:>>
    wrote:
    Occasionally I will do something silly and crash with error messages like
    this:

    panic: runtime error: index out of range

    goroutine 1 [syscall]:
    syscall.Syscall()
    /usr/lib64/golang/src/pkg/syscall/asm_linux_amd64.s:16 +0x5

    That is the message in its entirety. Upon further debugging with liberal
    print calls,
    I can find the source of the errors, but what I don't understand is why the
    stack
    trace only includes this low level call and not my own calls which caused
    the panic.
    Shouldn't the stack trace include...well the trace? What am I doing wrong
    here?
    Yes, I would expect the stack trace to show more. Without more
    information it's hard to know what is going wrong. One thing you can
    try is setting the environment variable GOTRACEBACK to 2 when running
    the program.

    Ian
    With GOTRACEBACK=2 I get:

    panic: runtime error: index out of range



    goroutine 1 [syscall]:

    syscall.Syscall()

         /usr/lib64/golang/src/pkg/syscall/asm_linux_amd64.s:16 +0x5



    goroutine 2 [syscall]:

    runtime.entersyscallblock()

         /usr/lib64/golang/src/pkg/runtime/proc.c:1334 +0x16e

    runtime.MHeap_Scavenger()

         /usr/lib64/golang/src/pkg/runtime/mheap.c:454 +0xee

    runtime.goexit()

         /usr/lib64/golang/src/pkg/runtime/proc.c:1223

    created by runtime.main

         /usr/lib64/golang/src/pkg/runtime/proc.c:165

    --
    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/groups/opt_out.
  • Ian Lance Taylor at Jan 24, 2014 at 4:53 pm

    On Fri, Jan 24, 2014 at 8:38 AM, wrote:
    On Friday, January 24, 2014 7:42:36 AM UTC-7, Ian Lance Taylor wrote:
    On Fri, Jan 24, 2014 at 12:07 AM, wrote:
    Occasionally I will do something silly and crash with error messages
    like
    this:

    panic: runtime error: index out of range

    goroutine 1 [syscall]:
    syscall.Syscall()
    /usr/lib64/golang/src/pkg/syscall/asm_linux_amd64.s:16 +0x5

    That is the message in its entirety. Upon further debugging with liberal
    print calls,
    I can find the source of the errors, but what I don't understand is why
    the
    stack
    trace only includes this low level call and not my own calls which
    caused
    the panic.
    Shouldn't the stack trace include...well the trace? What am I doing
    wrong
    here?
    Yes, I would expect the stack trace to show more. Without more
    information it's hard to know what is going wrong. One thing you can
    try is setting the environment variable GOTRACEBACK to 2 when running
    the program.
    With GOTRACEBACK=2 I get:

    panic: runtime error: index out of range

    goroutine 1 [syscall]:
    syscall.Syscall()
    /usr/lib64/golang/src/pkg/syscall/asm_linux_amd64.s:16 +0x5
    Something is clearly wrong but I don't know what it is. For some
    reason the goroutine that is actually getting the "index out of range"
    error is not being traced.

    If you can provide a test case, please open an issue for this
    (http://golang.org/issue/new). Thanks.

    If you can't provide a test case, I think you will need to try running
    under gdb. I have no explanation for what you are seeing.

    Ian

    --
    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/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 24, '14 at 1:36p
activeJan 24, '14 at 4:53p
posts4
users2
websitegolang.org

2 users in discussion

Ian Lance Taylor: 2 posts Jefflund: 2 posts

People

Translate

site design / logo © 2022 Grokbase