v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.37k stars 8.94k forks source link

运行时错误:invalid memory address or nil pointer dereference #36

Closed callmepeanut closed 9 years ago

callmepeanut commented 9 years ago

使用如下命令安装的: go get github.com/v2ray/v2ray-core go build github.com/v2ray/v2ray-core/release/server

错误信息如下: [ec2-user@ip ~]$ ./server --config="/home/ec2-user/vpoint_vmess_freedom.json" panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x0 pc=0x47b9cf]

goroutine 1 [running]: github.com/v2ray/v2ray-core/config/json.(*LogConfig).AccessLog(0x0, 0x5e3720, 0x780cd8) /home/ec2-user/work/src/github.com/v2ray/v2ray-core/config/json/json.go:40 +0x1f main.main() /home/ec2-user/work/src/github.com/v2ray/v2ray-core/release/server/main.go:58 +0x76d

goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 6 [runnable]: github.com/v2ray/v2ray-core/common/alloc.(*bufferPool).cleanup(0xc82000a2a0, 0xc82001a1e0) /home/ec2-user/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:93 created by github.com/v2ray/v2ray-core/common/alloc.newBufferPool /home/ec2-user/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:68 +0x153

goroutine 7 [runnable]: github.com/v2ray/v2ray-core/common/alloc.(*bufferPool).cleanup(0xc82000a2e0, 0xc82001a2a0) /home/ec2-user/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:93 created by github.com/v2ray/v2ray-core/common/alloc.newBufferPool /home/ec2-user/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:68 +0x153

goroutine 8 [runnable]: github.com/v2ray/v2ray-core/common/alloc.(*bufferPool).cleanup(0xc82000a320, 0xc82001a360) /home/ec2-user/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:93 created by github.com/v2ray/v2ray-core/common/alloc.newBufferPool /home/ec2-user/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:68 +0x153

oldmannt commented 9 years ago

遇到同样的问题,应该和callmepeanut是同一个版本,我的情况如下

OS: ubuntu server 14.04 64bit v2Ray 版本: 不知道怎样取得版本可功能,2015/10/10 10:30AM左右执行 go get github.com/v2ray/v2ray-core 取的代码。应该最新的,在项目首页copy sha得到的:b115df56c08aff26b80c5e1eb8134a594d84670b golang 版本:1.5.1 问题描述:把json文件复制到 GOPATH/bin/config,vpoint_vmess_freedom.json内容如下

"port": 27183, "inbound": { "protocol": "vmess", "settings": { "clients": [ {"id": "ec12cd1a-6e37-11e5-9d70-feff819cdc9f"} ], "udp": false } }, "outbound": { "protocol": "freedom", "settings": {} } }

执行./server --config="/root/work/bin/config/vpoint_vmess_freedom.json" 会报错,日志如下

root@xxxxxxxxx:~/work/bin# ./server --config="/root/work/bin/config/vpoint_vmess_freedom.json" panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x0 pc=0x47b9cf]

goroutine 1 [running]: github.com/v2ray/v2ray-core/config/json.(*LogConfig).AccessLog(0x0, 0x5e3720, 0x780cd8) /root/work/src/github.com/v2ray/v2ray-core/config/json/json.go:40 +0x1f main.main() /root/work/src/github.com/v2ray/v2ray-core/release/server/main.go:58 +0x76d

goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 6 [chan receive]: github.com/v2ray/v2ray-core/common/alloc.(*bufferPool).cleanup(0xc82000a1e0, 0xc820014240) /root/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:94 +0x58 created by github.com/v2ray/v2ray-core/common/alloc.newBufferPool /root/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:68 +0x153

goroutine 7 [chan receive]: github.com/v2ray/v2ray-core/common/alloc.(*bufferPool).cleanup(0xc82000a220, 0xc820014300) /root/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:94 +0x58 created by github.com/v2ray/v2ray-core/common/alloc.newBufferPool /root/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:68 +0x153

goroutine 8 [chan receive]: github.com/v2ray/v2ray-core/common/alloc.(*bufferPool).cleanup(0xc82000a260, 0xc8200143c0) /root/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:94 +0x58 created by github.com/v2ray/v2ray-core/common/alloc.newBufferPool /root/work/src/github.com/v2ray/v2ray-core/common/alloc/buffer.go:68 +0x153

callmepeanut commented 9 years ago

已解决,json配置文件加上“log”字段即可。 参照文件:https://github.com/v2ray/v2ray-core/blob/master/release/config/vpoint_vmess_freedom.json

v2ray commented 9 years ago

本质上这是一个 golang 的 bug,我已经向他们提 issue 了:https://github.com/golang/go/issues/12897