-
Notifications
You must be signed in to change notification settings - Fork 85
Conversation
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
"github.com/kshlm/pbrpc/pbcodec" | ||
) | ||
|
||
func (r *Connection) PeerAddRPCSvc(args *peer.PeerAddRequest, reply *RPCPeerAddResp) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is here. You should be the protobuf generated type RPCPeerAddReq
. You changed it in all other places, except this.
Because of this, ReadRequestBody
in pbcodec
isn't able to unmarshal the request body, and returns an error. The net/rpc
framework silently ignores this and doesn't log or pass up any errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, silly! I corrected it. Now that its hitting the server handler but still there is a deadlock, client is not get back the response :(
This is not the structure I expected for RPC. The GD2 RPC package will be a general RPC package, which will be mostly a wrapper around I would suggest the following directory/package structuring.
|
func (r *Connection) PeerAddRPCSvc(args *peer.PeerAddRequest, reply *RPCPeerAddResp) error { | ||
log.Debug("In PeerAdd") | ||
if context.MaxOpVersion < 40000 { | ||
*reply.OpRet = -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reply.OpRet
and reply.OpError
are nil pointers, pointing to nothing. There is actually no location for the data you are setting to be stored. This is a side effect of using protobuf. Protobuf generated structs use only pointers as members. net/rpc
package will allocate the struct and initialize the pointers to nil. The pointers will not be pointing to any allocated memory. You have to set these pointers to data you've allocated.
var (
opRet int32
opError string
)
// Update opRet and opError instead of reply.OpRet and reply.OpError
// before returning
reply.OpRet = &opRet
reply.OpError = &opError
return nil
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that did the trick! Many thanks @kshlm
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Looks good now. You have vim swap file committed, please remove it. Also, it'd be nice if the listener port were configurable. At least add a TODO for this. |
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Cross GlusterD interaction using pbrpc
No description provided.