grpc-tools icon indicating copy to clipboard operation
grpc-tools copied to clipboard

grpc-replay: failed to decode dump: invalid character 'ÿ' looking for beginning of value

Open MikaelFerland opened this issue 3 years ago • 4 comments

I have been able to dump successfully my requests, but when came the time to replay it I got that error: failed to decode dump: invalid character 'ÿ' looking for beginning of value

I'm running on Windows 10.

MikaelFerland avatar Nov 26 '20 17:11 MikaelFerland

Sounds like the JSON got corrupted somehow. Are you able to share a file that fails with this error?

If not, how are you saving the file to be replayed? Perhaps we can work out if some extra unexpected data is ending up in there

bradleyjkemp avatar Nov 26 '20 23:11 bradleyjkemp

I did that grpc-dump --port=8082 > start_core1.dump I let the client doing is request and when it's done I ended the dump with Ctrl+c All requests are starting with { and ending with }

I tried to replay only two lines of it and it blocked at the first request: {"service":"gRPCService.Service_gRPC","method":"ExecuteCommand","messages":[{"message_origin":"client","raw_message":"ClB7IlNlcnZlclB1Ymxpc2hpbmdQb3J0Ijo1NjEwMCwiQnJvYWRjYXN0VHlwZSI6MSwiQ29tbWFuZFR5cGUiOiJSZWdpc3RlckNvbW1hbmQifQ==","message":{"1":"{"ServerPublishingPort":56100,"BroadcastType":1,"CommandType":"RegisterCommand"}"},"timestamp":"2020-11-26T11:30:33.298248-05:00"},{"message_origin":"server","raw_message":"CAEaBWVtcHR5IjIKKHR5cGUuZ29vZ2xlYXBpcy5jb20vZ1JQQ1NlcnZpY2UuVmFyaWFibGUSBgoEbnVsbA==","message":{"1":"1","3":"empty","4":{"1":"type.googleapis.com/gRPCService.Variable","2":{"1":"null"}}},"timestamp":"2020-11-26T11:30:35.7582456-05:00"}],"metadata":{":authority":["192.168.0.10:1234"],"accept-encoding":["identity,gzip"],"content-type":["application/grpc"],"grpc-accept-encoding":["identity,deflate,gzip"],"user-agent":["grpc-csharp/2.33.1 grpc-c/13.0.0 (windows; chttp2)"],"via":["HTTP/2.0 127.0.0.1:1234"]},"metadata_response_headers":{"content-type":["application/grpc"],"date":["Thu, 26 Nov 2020 16:30:35 GMT"],"server":["Kestrel"]},"metadata_response_trailers":{}} {"service":"gRPCService.Service_gRPC","method":"ExecuteQuery","messages":[{"message_origin":"client","raw_message":"CiR7IlF1ZXJ5VHlwZSI6IkdldFNlcnZlcklvTGlzdFF1ZXJ5In0=","message":{"1":"{"QueryType":"GetServerIoListQuery"}"},"timestamp":"2020-11-26T11:30:36.2532521-05:00"},{"message_origin":"server","raw_message":"CAEiRwoodHlwZS5nb29nbGVhcGlzLmNvbS9nUlBDU2VydmljZS5WYXJpYWJsZRIbChl7IklvTGlzdCI6W10sIlZlcnNpb24iOjB9","message":{"1":"1","4":{"1":"type.googleapis.com/gRPCService.Variable","2":{"1":"{"IoList":[],"Version":0}"}}},"timestamp":"2020-11-26T11:30:36.3372486-05:00"}],"metadata":{":authority":["192.168.0.10:1234"],"accept-encoding":["identity,gzip"],"content-type":["application/grpc"],"grpc-accept-encoding":["identity,deflate,gzip"],"user-agent":["grpc-csharp/2.33.1 grpc-c/13.0.0 (windows; chttp2)"],"via":["HTTP/2.0 127.0.0.1:1234"]},"metadata_response_headers":{"content-type":["application/grpc"],"date":["Thu, 26 Nov 2020 16:30:36 GMT"],"server":["Kestrel"]},"metadata_response_trailers":{}}

MikaelFerland avatar Nov 27 '20 14:11 MikaelFerland

Ah I see the problem:

"message":{"1":"{"ServerPublishingPort":56100,"BroadcastType":1,"CommandType":"RegisterCommand"}"}

This isn't valid JSON because the quotes aren't being escaped inside the string. It should be more like:

"message":{"1":"{\"ServerPublishingPort\":56100,\"BroadcastType\":1,\"CommandType\":\"RegisterCommand\"}"}

Really weird that that's happened. I'll have a look at what could be causing it within grpc-dump

bradleyjkemp avatar Nov 27 '20 14:11 bradleyjkemp

For future, are you able to provide the line number with the error?

MikaelFerland avatar Nov 27 '20 15:11 MikaelFerland