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 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型