Panic in HTTP server when under siege

168 views
Skip to first unread message

tomwilde

unread,
May 30, 2012, 4:55:33 PM5/30/12
to golan...@googlegroups.com
Hi

The following is the relevant piece of the stack trace I get when running siege against my web application written in Go:


/opt/go/src/pkg/runtime/proc.c:1443 (0x4102b7)
panic: reflect·call(d->fn, d->args, d->siz);
/opt/go/src/pkg/runtime/runtime.c:128 (0x410e5b)
panicstring: runtime·panic(err);

/opt/go/src/pkg/runtime/thread_linux.c:209 (0x413d4e)
sigpanic: runtime·panicstring("invalid memory address or nil pointer dereference");

/opt/go/src/pkg/bufio/bufio.go:0 (0x488c14)
(*ReadWriter).Write: ???

/opt/go/src/pkg/fmt/print.go:214 (0x41a78a)
Fprintf: n64, err := w.Write(p.buf)

/opt/go/src/pkg/net/http/server.go:495 (0x4535b8)
(*response).Write: fmt.Fprintf(w.conn.buf, "%x\r\n", len(data)) // TODO(rsc): use strconv not fmt

/opt/go/src/pkg/fmt/print.go:214 (0x41a78a)
Fprintf: n64, err := w.Write(p.buf)

/home/projects/src/handlers/home/home.go:14 (0x42761e)
Home: fmt.Fprintf(c.Output, "%#v", c.Session)


The panic occurred sporadically, 99% of the requests where answered, only 6 out of 1000 requests had this problem.

Is this a bug?

tomwilde

unread,
May 30, 2012, 4:57:41 PM5/30/12
to golan...@googlegroups.com
Clarification: is this a bug ... in Go's standard library?

Brad Fitzpatrick

unread,
May 30, 2012, 6:27:07 PM5/30/12
to tomwilde, golan...@googlegroups.com
I've never seen this before.

Can you open a bug with the siege command line and a minimal Go program to reproduce?

Just a guess: are you writing to your http.ResponseWriter concurrently from different goroutines?

Also: What version of Go? What OS?

Dave Cheney

unread,
May 30, 2012, 7:27:23 PM5/30/12
to Brad Fitzpatrick, tomwilde, golan...@googlegroups.com
sigpanic: runtime·panicstring("invalid memory address or nil pointer
dereference");

^ I think this or something similar was fixed in go1.0.1

http://code.google.com/p/go/source/detail?r=479138396750acaa84f2026a815d59f1d80f3117&name=release-branch.go1

but please log an issue on the issue tracker as Brad suggests so we
have all the details needed to investigate.

Cheers

Dave

Thomas Wilde

unread,
May 31, 2012, 2:45:17 AM5/31/12
to Brad Fitzpatrick, golan...@googlegroups.com

Hi, I'll reduce the code and file an issue later today. Thanks for your answers.

Thomas Wilde

unread,
Jun 3, 2012, 7:24:42 PM6/3/12
to Dave Cheney, golan...@googlegroups.com
Hi Dave and Brad

Regretfully not, I have been trying to reproduce the error with the minimal amount of code possible but with no luck. I'm hoping I can find some more time next weekend to get this done. Posting the entire code would only be a headache to whoever has to find the problem.

To answer Brad's question; no, I checked the code and there's no place where two goroutines write to the same http.ResponseWriter. And I updated to Go 1.0.1 and the error still remains.
Please be patient, I will report back - I'm just having a little trouble to find the time right now because of work.

Cheers,

Thomas

On Mon, Jun 4, 2012 at 12:23 AM, Dave Cheney <da...@cheney.net> wrote:
Hi Thomas, any luck producing a test case ?

Brad Fitzpatrick

unread,
Jun 3, 2012, 7:29:53 PM6/3/12
to Thomas Wilde, Dave Cheney, golan...@googlegroups.com
Can you reproduce it reliably without minimized code?
Reply all
Reply to author
Forward
0 new messages