Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: TestChunkReaderAllocs fails #6076

Closed
alexbrainman opened this issue Aug 8, 2013 · 7 comments
Closed

net/http: TestChunkReaderAllocs fails #6076

alexbrainman opened this issue Aug 8, 2013 · 7 comments
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@alexbrainman
Copy link
Member

hg id
d881cb1ffc14 tip

c:\>http.test.exe -test.short
--- FAIL: TestChunkReaderAllocs (0.02 seconds)
        chunked_test.go:67: 15 mallocs; want <= 1
2013/08/08 11:10:02 net/http: invalid byte ' ' in Cookie.Value; dropping invalid bytes
2013/08/08 11:10:02 net/http: invalid byte '\x00' in Cookie.Value; dropping invalid bytes
2013/08/08 11:10:02 net/http: invalid byte '"' in Cookie.Value; dropping invalid
bytes
2013/08/08 11:10:02 net/http: invalid byte ';' in Cookie.Path; dropping invalid
bytes
FAIL

It looks to me that gc kicks in during the test and it calls mallocgc that counts
allocations, therefore test fails. If you apply patch attached, you can see this stack
trace:

PanicOnMalloc: #4 size=4096 type=6287489
PanicOnMalloc: #3 size=117 type=0
PanicOnMalloc: #2 size=41 type=0
PanicOnMalloc: #1 size=46 type=0
fatal error: ALEX

runtime stack:
runtime.throw(0x91e35b)
    /root/go/root/src/pkg/runtime/panic.c:498 +0x67
runtime.mallocgc(0x2e, 0x0, 0x13)
    /root/go/root/src/pkg/runtime/malloc.goc:67 +0xdd
runtime.settype_flush(0x925340)
    /root/go/root/src/pkg/runtime/malloc.goc:620 +0x1fc
gc(0x3116643c)
    /root/go/root/src/pkg/runtime/mgc0.c:2087 +0x60
mgc(0x1115e5a0)
    /root/go/root/src/pkg/runtime/mgc0.c:2065 +0x2d
runtime.mcall(0x6ffe0)
    /root/go/root/src/pkg/runtime/asm_386.s:188 +0x33

goroutine 4 [garbage collection]:
runtime.gc(0x0)
    /root/go/root/src/pkg/runtime/mgc0.c:2034 +0x2b0 fp=0x31166448
runtime.mallocgc(0x1000, 0x5ff081, 0x1)
    /root/go/root/src/pkg/runtime/malloc.goc:155 +0x288 fp=0x31166484
cnew(0x5ff080, 0x1000, 0x1)
    /root/go/root/src/pkg/runtime/malloc.goc:731 +0xa9 fp=0x31166494
runtime.cnewarray(0x5ff080, 0x1000)
    /root/go/root/src/pkg/runtime/malloc.goc:744 +0x3b fp=0x311664a4
makeslice1(0x5f54c0, 0x1000, 0x1000, 0x311664e4)
    /root/go/root/src/pkg/runtime/slice.c:56 +0x47 fp=0x311664b0
runtime.makeslice(0x5f54c0, 0x1000, 0x0, 0x1000, 0x0, ...)
    /root/go/root/src/pkg/runtime/slice.c:37 +0x96 fp=0x311664d0
bufio.(*Reader).allocBuf(0x11153600)
    /root/go/root/src/pkg/bufio/bufio.go:90 +0xc4 fp=0x3116650c
bufio.(*Reader).fill(0x11153600)
    /root/go/root/src/pkg/bufio/bufio.go:109 +0x2a fp=0x31166564
bufio.(*Reader).ReadSlice(0x11153600, 0xa, 0x0, 0x0, 0x0, ...)
    /root/go/root/src/pkg/bufio/bufio.go:307 +0x186 fp=0x311665bc
net/http.readLine(0x11153600, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/root/src/pkg/net/http/chunked.go:91 +0x57 fp=0x311665dc
net/http.(*chunkedReader).beginChunk(0x1117d820)
    /root/go/root/src/pkg/net/http/chunked.go:47 +0x2c fp=0x311665fc
net/http.(*chunkedReader).Read(0x1117d820, 0x11153630, 0x2b, 0x2b, 0x40a70e, ...)
    /root/go/root/src/pkg/net/http/chunked.go:65 +0x6c fp=0x3116663c
io.ReadAtLeast(0xf1c4a8, 0x1117d820, 0x11153630, 0x2b, 0x2b, ...)
    /root/go/root/src/pkg/io/io.go:288 +0xb4 fp=0x31166668
io.ReadFull(0xf1c4a8, 0x1117d820, 0x11153630, 0x2b, 0x2b, ...)
    /root/go/root/src/pkg/io/io.go:306 +0x5e fp=0x31166690
net/http.TestChunkReaderAllocs(0x111595a0)
    /root/go/root/src/pkg/net/http/chunked_test.go:64 +0x37d fp=0x3116679c
testing.tRunner(0x111595a0, 0x92000c)
    /root/go/root/src/pkg/testing/testing.go:360 +0x88 fp=0x311667c8
runtime.goexit()
    /root/go/root/src/pkg/runtime/proc.c:1332 fp=0x311667cc
created by testing.RunTests
    /root/go/root/src/pkg/testing/testing.go:440 +0x69b

goroutine 1 [chan receive]:
runtime.park(0x40a6c0, 0x111535fc, 0x91d44d)
    /root/go/root/src/pkg/runtime/proc.c:1280 +0x63
runtime.chanrecv(0x5f6500, 0x111535d0, 0x31151644, 0x0, 0x0)
    /root/go/root/src/pkg/runtime/chan.c:359 +0x49f
runtime.chanrecv1(0x5f6500, 0x111535d0, 0x0, 0x111535d0)
    /root/go/root/src/pkg/runtime/chan.c:451 +0x2f
testing.RunTests(0x6ef344, 0x920000, 0xa4, 0xa4, 0x921d01)
    /root/go/root/src/pkg/testing/testing.go:441 +0x6b6
testing.Main(0x6ef344, 0x920000, 0xa4, 0xa4, 0x91b960, ...)
    /root/go/root/src/pkg/testing/testing.go:372 +0x6a
main.main()
    net/http/_test/_testmain.go:409 +0x82
runtime.main()
    /root/go/root/src/pkg/runtime/proc.c:200 +0x102
runtime.goexit()
    /root/go/root/src/pkg/runtime/proc.c:1332

goroutine 2 [syscall]:
runtime.notetsleepg(0x31167f9c, 0xf8475800, 0xd)
    /root/go/root/src/pkg/runtime/lock_sema.c:253 +0x73
runtime.MHeap_Scavenger()
    /root/go/root/src/pkg/runtime/mheap.c:461 +0xc2
runtime.goexit()
    /root/go/root/src/pkg/runtime/proc.c:1332
created by runtime.main
    /root/go/root/src/pkg/runtime/proc.c:167


Alex

Attachments:

  1. patch.diff (1433 bytes)
@rsc
Copy link
Contributor

rsc commented Sep 10, 2013

Comment 1:

Labels changed: added testing.

@rsc
Copy link
Contributor

rsc commented Oct 2, 2013

Comment 2:

Labels changed: added go1.3, removed go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-go1.3.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: removed go1.3.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

@bradfitz
Copy link
Contributor

Comment 6:

Sent https://golang.org/cl/53810043

Owner changed to @bradfitz.

Status changed to Started.

@bradfitz
Copy link
Contributor

Comment 7:

This issue was closed by revision 6592aeb.

Status changed to Fixed.

@alexbrainman alexbrainman added fixed Testing An issue that has been verified to require only test changes, not just a test failure. labels Jan 19, 2014
@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

4 participants