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

encoding/json: TestBlocking test fails #5486

Closed
alexbrainman opened this issue May 16, 2013 · 8 comments
Closed

encoding/json: TestBlocking test fails #5486

alexbrainman opened this issue May 16, 2013 · 8 comments

Comments

@alexbrainman
Copy link
Member

# hg id                                                               
909d1af80cd0+                                                                 
# hg diff                                                             
diff -r 909d1af80cd0 src/pkg/encoding/json/stream_test.go                     
--- a/src/pkg/encoding/json/stream_test.go      Tue May 14 16:38:12 2013 -0700
+++ b/src/pkg/encoding/json/stream_test.go      Thu May 16 10:17:30 2013 +1000
@@ -177,6 +177,12 @@                                                          
 }                                                                            
                                                                              
 func TestBlocking(t *testing.T) {                                            
+       for i := 0; i < 1000; i++ {                                           
+               testBlocking(t)                                               
+       }                                                                     
+}                                                                            
+                                                                             
+func testBlocking(t *testing.T) {                                            
        for _, enc := range blockingTests {                                   
                r, w := net.Pipe()                                            
                go w.Write([]byte(enc))                                       
# go test -v -run=Blo                                                       
=== RUN TestBlocking                                                                 
--- FAIL: TestBlocking (0.02 seconds)                                                
        stream_test.go:194: decoding [1, 2, 3]: invalid character '\x00' looking for beginning of value                                                                   
FAIL                                                                                 
exit status 1                                                                        
FAIL    encoding/json   0.027s                                                       
#                                                                           

I use linux/386. It looks like broken by:

changeset:   16794:909d1af80cd0
user:        Carl Shapiro <cshapiro@google.com>
date:        Tue May 14 16:38:12 2013 -0700
summary:     runtime: enable stack scanning by frames

Alex
@lexprfuncall
Copy link

Comment 2:

Thanks for the defect report.  I am able to reproduce this issue on a 64-bit Linux.  I
am looking into it right now.

@bradfitz
Copy link
Contributor

Comment 3:

Should we roll it back until there's a fix?

@lexprfuncall
Copy link

Comment 4:

A quick update.  It looks like there is some confusion about scanning the incoming
arguments of a goroutine.  If I change the following line from testBlocking
  go w.Write([]byte(enc))
to force writing the argument to Write onto the stack
  b := []byte(enc)
  _ = b
  go w.Write(b)
the crash will no longer reproduce.

@lexprfuncall
Copy link

Comment 5:

Brad, yes we can always disable the new stack scan with a flag flip.  It is a one-liner.
 If I cannot get out a fix quickly I will send out a change to disable the scanning by
frames.

@lexprfuncall
Copy link

Comment 6:

This crash is caused by the GC ignoring the incoming arguments of a function with
unknown argument size when that function happens to be the initial function of a not
started goroutine.
There is special case code in the general stack scanner to handle functions with an
unknown argument size.  This logic needs to be replicated in the not started goroutine
stack scanner.
I will have a patch shortly.  Fortunately, it is a one-liner.

Status changed to Started.

@lexprfuncall
Copy link

Comment 7:

https://golang.org/cl/9440043

@lexprfuncall
Copy link

Comment 8:

Owner changed to @lexprfuncall.

@lexprfuncall
Copy link

Comment 9:

This issue was closed by revision 50ba6e1.

Status changed to Fixed.

@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.
Projects
None yet
Development

No branches or pull requests

4 participants