You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. run attached breakjsonrpc.go
2. run attached gorpc.py
What is the expected output?
A single "connection reset" log message:
2011/05/14 16:36:34 rpc: rpc: server cannot decode request: read tcp [::1]:52123:
connection reset by peer
What do you see instead?
The above log message is repeated ad infinitum.
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
Ubuntu 11.04
Which revision are you using? (hg identify)
5d2ce135523+ (release-branch.r57) release/release.r57.1
I did check top of tree, though.
Please provide any additional information below.
The underlying problem is that rpc.*Server·ServeCodec serves until it gets an os.EOF or
io.ErrUnexpectedEOF, but json.*Decoder·readValue gets a net.OpError, so it just loops
forever, trying and failing to read from the same connection.
Two possible fixes:
- rpc.*Server·ServeCodec stops serving for all error types instead of just os.EOF and
io.ErrUnexpectedEOF
- jsonrpc.*serverCodec·ReadRequestHeader, which calls into the json decoder, masks all
non-eof errors as io.ErrUnexpectedEOF
I'm not sure of the ramifications for the first, so I tried the second, and it appears
to work. Here's a patch that does it:
--- a/src/pkg/rpc/jsonrpc/server.go Wed May 04 00:17:17 2011 -0400
+++ b/src/pkg/rpc/jsonrpc/server.go Sat May 14 17:34:33 2011 -0700
@@ -67,6 +67,9 @@
func (c *serverCodec) ReadRequestHeader(r *rpc.Request) os.Error {
c.req.reset()
if err := c.dec.Decode(&c.req); err != nil {
+ if err != os.EOF {
+ return io.ErrUnexpectedEOF
+ }
return err
}
r.ServiceMethod = c.req.Method
by viscous:
Attachments:
The text was updated successfully, but these errors were encountered: