douyuanliao8815 2015-08-30 14:28
浏览 39
已采纳

如何调试狂欢版本崩溃日志?

I want to put my app in production but I am having trouble understanding this error log that I am getting while trying to do revel build app

This is part of log:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x40c485]

goroutine 1 [running]:
main.func·002()
    /home/johnny/data/go/src/github.com/revel/cmd/revel/rev.go:71 +0x7e
main.func·003(0xc208a4a400, 0x1001, 0x0, 0x0, 0x7ff4863a9238, 0xc2081ee420, 0x0, 0x0)
    /home/johnny/data/go/src/github.com/revel/cmd/revel/util.go:96 +0x2b5
path/filepath.walk(0xc208617000, 0xff1, 0x7ff4863a9260, 0xc20883cff0, 0xc2085799c8, 0x0, 0x0)
    /usr/lib/go/src/path/filepath/path.go:368 +0x430

Other lines in log always reffer to this /usr/lib/go/src/path/filepath/path.go

and at the end of log is this:

goroutine 5 [syscall]:
os/signal.loop()
    /usr/lib/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
    /usr/lib/go/src/os/signal/signal_unix.go:27 +0x35

This log reminds me of objective C and I know how is hard to debug that.

Maybe I am missing something in routes somewhere? I have some files in .gitignore (i am not sure if that has to do something with a crash?)

  • 写回答

1条回答 默认 最新

  • dtebrq0245 2015-08-30 18:03
    关注

    You probably need to get familiar with Go stack traces. Here is nice tutorial: http://www.goinggo.net/2015/01/stack-traces-in-go.html

    Basically, you have to look for the goroutine in the [running] state (it usually on the very top of the stack trace) and find out line, which triggered panic.

    In this example, github.com/revel/cmd/revel/util.go:96 looks like this:

            if info.IsDir() {
                err := os.MkdirAll(path.Join(destDir, relSrcPath), 0777)
                if !os.IsExist(err) {
                    panicOnError(err, "Failed to create directory")
                }
                return nil
            }
    

    Panic says panic: runtime error: invalid memory address or nil pointer dereference, so it must be info to be nil (you can see it also as 0x0 in the call to path/filepath.Walk.

    Looks like revel bug, not sure without full code/env information.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 ubuntu系统下挂载磁盘上执行./提示权限不够
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)