-
Notifications
You must be signed in to change notification settings - Fork 18k
encoding/gob: TestFuzz can use a lot of memory #3225
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
Labels
Milestone
Comments
% ulimit -a socket buffer size (bytes, -b) unlimited core file size (blocks, -c) unlimited data seg size (kbytes, -d) 2097152 file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 7207 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 65536 cpu time (seconds, -t) unlimited max user processes (-u) 3603 virtual memory (kbytes, -v) unlimited swap size (kbytes, -w) unlimited |
There is a separate bug about not being able to use more than 512 MB on 32-bit. Do you believe that the fuzz input should not be causing gob to try to allocate that much memory? If the allocation is appropriate for the input, then this is not a bug in gob but a dup of the runtime bug, which Remy has a CL pending for. Russ |
I agree with you, that supposed root cause would be runtime. I just filed for the record of first binary distribution trial. ;) By the way, unfortunately CL 5725045 doesn't fix the issue for 32-bit memory allocator. http://golang.org/cl/5725045/ % go test -v encoding/gob (snip) === RUN TestFuzz runtime: out of memory: cannot allocate 806223872-byte block (1048576 in use) throw: out of memory goroutine 23 [running]: encoding/gob.(*Decoder).readMessage(0x9828a820, 0x300d0369, 0x98269b40) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:92 +0x5a encoding/gob.(*Decoder).recvMessage(0x9828a820, 0x0, 0x1) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:84 +0xaa encoding/gob.(*Decoder).decodeTypeSequence(0x9828a820, 0x98289400, 0x160, 0x0) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:142 +0x57 encoding/gob.(*Decoder).DecodeValue(0x9828a820, 0x80f9c70, 0x98289410, 0x160, 0x0, ...) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:206 +0xe4 encoding/gob.(*Decoder).Decode(0x9828a820, 0x80f9c68, 0x98289410, 0x98289410, 0x9828d4e0, ...) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:185 +0x168 encoding/gob.encFuzzDec(0x9827bcc8, 0x80f9ba0, 0x9827bc70, 0x982373e0, 0x982381a0, ...) /home/mikioh/go/src/pkg/encoding/gob/codec_test.go:1429 +0x287 encoding/gob.testFuzz(0x98281d00, 0xf9d05b78, 0x1278fce3, 0x64, 0xb8245f68, ...) /home/mikioh/go/src/pkg/encoding/gob/codec_test.go:1468 +0x1a4 encoding/gob.TestFuzz(0x98281d00, 0xe) /home/mikioh/go/src/pkg/encoding/gob/codec_test.go:1452 +0x2fa testing.tRunner(0x98281d00, 0x8212bf8, 0x0) /home/mikioh/go/src/pkg/testing/testing.go:271 +0x6e created by testing.RunTests /home/mikioh/go/src/pkg/testing/testing.go:346 +0x687 goroutine 1 [chan receive]: testing.RunTests(0x8048c00, 0x8212b08, 0x49, 0x49, 0x8203101, ...) /home/mikioh/go/src/pkg/testing/testing.go:347 +0x6a7 testing.Main(0x8048c00, 0x8212b08, 0x49, 0x49, 0x820f570, ...) /home/mikioh/go/src/pkg/testing/testing.go:282 +0x46 main.main() /tmp/go-build357021947/encoding/gob/_test/_testmain.go:191 +0x4e goroutine 2 [syscall]: created by runtime.main /home/mikioh/go/src/pkg/runtime/proc.c:221 exit status 2 FAIL encoding/gob 0.034s % hg id 99a66fff2af2+ tip % hg p 5725045: runtime: try extending arena size in 32-bit allocator. |
vm5% dmesg | grep memory real memory = 2147483648 (2048 MB) avail memory = 2091053056 (1994 MB) // with CL 5725045 vm5% go test -v encoding/gob -run=TestFuzz === RUN TestFuzz --- PASS: TestFuzz (0.01 seconds) codec_test.go:1465: seed=1331108516916737000 n=100 e=*int codec_test.go:1465: seed=1331108516916737000 n=100 e=*float32 codec_test.go:1465: seed=1331108516916737000 n=100 e=*float64 codec_test.go:1465: seed=1331108516916737000 n=100 e=*complex128 codec_test.go:1465: seed=1331108516916737000 n=100 e=*gob.ByteStruct codec_test.go:1465: seed=1331108516916737000 n=100 e=*gob.ArrayStruct codec_test.go:1465: seed=1331108516916737000 n=100 e=*gob.StringStruct codec_test.go:1465: seed=1331108516916737000 n=100 e=*gob.GobTest1 === RUN TestFuzzRegressions runtime: out of memory: cannot allocate 268500992-byte block (271712256 in use) throw: out of memory goroutine 4 [running]: encoding/gob.(*Decoder).readMessage(0xa8481be0, 0x1000cf66, 0xa847b620) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:92 +0x5a encoding/gob.(*Decoder).recvMessage(0xa8481be0, 0x0, 0x1) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:84 +0xaa encoding/gob.(*Decoder).decodeTypeSequence(0xa8481be0, 0xa8479c00, 0x160, 0x0) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:142 +0x57 encoding/gob.(*Decoder).DecodeValue(0xa8481be0, 0x80fd260, 0xa8479c68, 0x160, 0x0, ...) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:206 +0xe4 encoding/gob.(*Decoder).Decode(0xa8481be0, 0x80fd258, 0xa8479c68, 0xa8479c68, 0xa8484f00, ...) /home/mikioh/go/src/pkg/encoding/gob/decoder.go:185 +0x168 encoding/gob.encFuzzDec(0xa84654b0, 0x80fcf88, 0xa8465488, 0x982333e0, 0x9823e1b0, ...) /home/mikioh/go/src/pkg/encoding/gob/codec_test.go:1429 +0x287 encoding/gob.testFuzz(0xa8468380, 0x994c53f0, 0x126fc084, 0x64, 0xb824cfa4, ...) /home/mikioh/go/src/pkg/encoding/gob/codec_test.go:1468 +0x1a4 encoding/gob.TestFuzzRegressions(0xa8468380, 0xe) /home/mikioh/go/src/pkg/encoding/gob/codec_test.go:1457 +0x99 testing.tRunner(0xa8468380, 0x8219c44, 0x0) /home/mikioh/go/src/pkg/testing/testing.go:271 +0x6e created by testing.RunTests /home/mikioh/go/src/pkg/testing/testing.go:346 +0x687 goroutine 1 [chan receive]: testing.RunTests(0x8048c00, 0x8219b48, 0x49, 0x49, 0x820a101, ...) /home/mikioh/go/src/pkg/testing/testing.go:347 +0x6a7 testing.Main(0x8048c00, 0x8219b48, 0x49, 0x49, 0x82165b0, ...) /home/mikioh/go/src/pkg/testing/testing.go:282 +0x46 main.main() /tmp/go-build628245346/encoding/gob/_test/_testmain.go:191 +0x4e goroutine 2 [syscall]: created by runtime.main /home/mikioh/go/src/pkg/runtime/proc.c:221 exit status 2 FAIL encoding/gob 0.040s |
It shouldn't ever be more than a few bytes: http://code.google.com/p/go/source/browse/src/pkg/encoding/gob/codec_test.go#1436 the fuzz test just corrupts the bytes for a single encoded object at this point. |
This test is already skipped for -short. It is true that the fuzzer can create gobs that happen to describe very large data structures. Sometimes they don't fit completely in memory. I think this is nearly unavoidable. Labels changed: added priority-later, removed priority-go1. Status changed to LongTerm. |
Should this issue be marked as resolved ? https://code.google.com/p/go/source/detail?r=547c731ab1299c7d8b4b7075195254ea18bbd488 |
Just tested this on tip. It takes around 400MB now.
When I try 300MB, it always fails.
If there's nothing else to be done here, perhaps this can be closed. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: