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/rpc: The client.Go result is different between Win7 and Linux. #5648

Closed
chai2010 opened this issue Jun 6, 2013 · 2 comments
Closed

net/rpc: The client.Go result is different between Win7 and Linux. #5648

chai2010 opened this issue Jun 6, 2013 · 2 comments

Comments

@chai2010
Copy link
Contributor

chai2010 commented Jun 6, 2013

The client.Go use the same buffer chan *rpc.Call.
The test output is different

-----------------------------------------------------------
Win6/amd64

go version
go version devel +24deeb374803 Tue Jun 04 21:51:22 2013 -0700 windows/amd64

go run rpctest.go
2013/06/06 16:55:14 Add: expected 0 got 15
exit status 1

-----------------------------------------------------------
CentOS6.3/amd64

go version
go version go1.1 linux/amd64

go run rpctest.go
Arith: 7+8=15
Arith: 7*8=56

-----------------------------------------------------------

Attachments:

  1. rpctest.go (1632 bytes)
@vdobler
Copy link
Contributor

vdobler commented Jun 6, 2013

Comment 1:

IMHO: Works as intended. The attached rpctest.go is buggy
from line 53 on (a bit restructured)
  done := done := make(chan *rpc.Call, 8)
  addReply, mulReply := new(Reply), new(Reply)
  mulCall := client.Go("Arith.Mul", args, mulReply, done)
  addCall := client.Go("Arith.Add", args, addReply, done)
  addCall = <-addCall.Done
  if addReply.C != args.A+args.B {
    log.Fatalf("Add: expected %d got %d", addReply.C, args.A+args.B)
  }
So: addCall.Done == mulCal.Done == done
Now addCall = <-addCall.Done is basically
firstFinishedCall := <- done; addCall = firstFinishedCall
which might be the multiplication. 
Testing now for addReply != something if wrong as the
firstFinishedCall might not be the addition
(even when stored into a variable called "addCall").

@robpike
Copy link
Contributor

robpike commented Jun 6, 2013

Comment 2:

Status changed to Invalid.

@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