veyron2/vdl: Fix race in TypeFromReflect.
The race would cause TypeBuilder to be called with two different
pointers for the same underlying type, which results in the
"duplicate type names" error.
FYI I tried to add a localized test to expose the race, but was
unsuccessful. Note that there's already a multi-goroutine test
in TestTypeFromReflect.
This fixes bug #585, where TestDebugServer would reliably fail
within ~100 runs without the fix, and passes 1000 runs with the
fix.
Change-Id: I1bd3dc6433a52fd3f9d9acc12f61dddd11ffcc88
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 544ed1c..fae6ce0 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -712,7 +712,7 @@
TraceRequest: ivtrace.Request(fc.ctx),
}
if err := fc.enc.Encode(req); err != nil {
- berr := verror.Make(verror.BadProtocol, fc.ctx, verror.Make(errRequestEncoding, fc.ctx, req, err))
+ berr := verror.Make(verror.BadProtocol, fc.ctx, verror.Make(errRequestEncoding, fc.ctx, fmt.Sprintf("%#v", req), err))
return fc.close(berr)
}
for _, d := range fc.discharges {