pratikju / servidor

A smart light-weight git http server
MIT License
48 stars 10 forks source link

runtime error: invalid memory address or nil pointer dereference in service.go #2

Open scriptator opened 8 years ago

scriptator commented 8 years ago

Since a few days I am running servidor on my raspberrypi behind an nginx reverse proxy in a systemd service. For few days it worked like a charm but yesterday I noticed that the service crashed. Unfortunately I can't remember the action that made it crash because I noticed the outage only in the evening but the logs tell me it crashed at 12:10.

The last lines in my nginx access log are:

XX.XX.XX.XX - - [21/Jun/2016:12:14:09 +0000] "GET /username/myproject.git/info/refs?service=git-upload-pack HTTP/1.1" 401 92 "-" "git/2.9.0"
XX.XX.XX.XX - - [21/Jun/2016:12:14:09 +0000] "GET /username/myproject.git/info/refs?service=git-upload-pack HTTP/1.1" 401 92 "-" "git/2.9.0"
XX.XX.XX.XX - username [21/Jun/2016:12:14:10 +0000] "GET /username/myproject.git/info/refs?service=git-upload-pack HTTP/1.1" 200 2048 "-" "git/2.9.0"

The respective lines in syslog:

Jun 21 12:14:10 raspberrypi servidor[2432]: panic: runtime error: invalid memory address or nil pointer dereference
Jun 21 12:14:10 raspberrypi servidor[2432]: [signal 0xb code=0x1 addr=0xc pc=0x176934]
Jun 21 12:14:10 raspberrypi servidor[2432]: goroutine 139 [running]:
Jun 21 12:14:10 raspberrypi servidor[2432]: panic(0x38a1a0, 0x5642e030)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/runtime/panic.go:481 +0x330
Jun 21 12:14:10 raspberrypi servidor[2432]: bufio.(*Writer).Write(0x0, 0x5647e800, 0x800, 0x800, 0x0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/bufio/bufio.go:589 +0x3c
Jun 21 12:14:10 raspberrypi servidor[2432]: net/http.(*chunkWriter).Write(0x56549118, 0x5647e800, 0x800, 0x800, 0x0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/net/http/server.go:267 +0x27c
Jun 21 12:14:10 raspberrypi servidor[2432]: bufio.(*Writer).flush(0x564cb7e0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/bufio/bufio.go:562 +0xb0
Jun 21 12:14:10 raspberrypi servidor[2432]: bufio.(*Writer).Write(0x564cb7e0, 0x56528000, 0x3b, 0x8000, 0x0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/bufio/bufio.go:598 +0x208
Jun 21 12:14:10 raspberrypi servidor[2432]: net/http.(*response).write(0x56549100, 0x3b, 0x56528000, 0x3b, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/net/http/server.go:1237 +0x1e0
Jun 21 12:14:10 raspberrypi servidor[2432]: net/http.(*response).Write(0x56549100, 0x56528000, 0x3b, 0x8000, 0x0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/net/http/server.go:1209 +0x60
Jun 21 12:14:10 raspberrypi systemd[1]: servidor.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Jun 21 12:14:10 raspberrypi systemd[1]: Unit servidor.service entered failed state.
Jun 21 12:14:10 raspberrypi servidor[2432]: net/http.(*writerOnly).Write(0x565629a0, 0x56528000, 0x3b, 0x8000, 0x3b, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: <autogenerated>:247 +0x90
Jun 21 12:14:10 raspberrypi servidor[2432]: io.copyBuffer(0x45a90060, 0x565629a0, 0x44a54150, 0x56508d18, 0x56528000, 0x8000, 0x8000, 0x7c0, 0x0, 0x0, ...)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/io/io.go:382 +0x22c
Jun 21 12:14:10 raspberrypi servidor[2432]: io.CopyBuffer(0x45a90060, 0x565629a0, 0x44a54150, 0x56508d18, 0x56528000, 0x8000, 0x8000, 0x45a90030, 0x1, 0x0, ...)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/io/io.go:361 +0xcc
Jun 21 12:14:10 raspberrypi servidor[2432]: net/http.(*response).ReadFrom(0x56549100, 0x44a54150, 0x56508d18, 0x0, 0x0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/net/http/server.go:430 +0x6e0
Jun 21 12:14:10 raspberrypi servidor[2432]: io.copyBuffer(0x44a55780, 0x56549100, 0x44a54150, 0x56508d18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/io/io.go:374 +0x124
Jun 21 12:14:10 raspberrypi servidor[2432]: io.Copy(0x44a55780, 0x56549100, 0x44a54150, 0x56508d18, 0x0, 0x44a558a0, 0x0, 0x0)
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/local/go/src/io/io.go:350 +0x64
Jun 21 12:14:10 raspberrypi servidor[2432]: created by main.serviceHandler
Jun 21 12:14:10 raspberrypi servidor[2432]: /usr/share/go/src/github.com/gophergala2016/servidor/service.go:41 +0x774

Does somebody have an idea what is going on?

pratikju commented 8 years ago

I am not able make out why io.Copy would give nil pointer. Please give me more details and logs to work with.

scriptator commented 8 years ago

Unfortunately that's all I currently have. If the problem occurs again I can perhaps gather more logs and tell more precisely what my last actions were.