ghz icon indicating copy to clipboard operation
ghz copied to clipboard

read data failed with error "illegal base64 data at input byte 0"

Open pizhicheng opened this issue 3 years ago • 2 comments

Proto file(s) basic-meta.proto:

syntax = "proto3";
package com.webank.ai.fate.api.core;
// network endpoint
message Endpoint {
    string ip = 1;          // ip address
    int32 port = 2;         // port
    string hostname = 3;    // host name
    bool useSSL = 4;
    string negotiationType = 5;
    string certChainFile = 6;
    string privateKeyFile = 7;
    string caFile = 8;
    string url = 9;
}
message Endpoints {
    repeated Endpoint endpoints = 1;
}
// general container for serialized data
message Data {
    bool isNull = 1;            // whether the data is actually 'null' (e.g. null in Java, None in python, NULL in c/c++
    string hostLanguage = 2;    // the host language which serializes it
    string type = 3;            // data type in host language
    bytes data = 4;             // actual data serialized in bytes
}
// general container for data list
message RepeatedData {
    repeated Data datalist = 1; // list of data
}
// general message for a call request
message CallRequest {
    bool isAsync = 1;           // whether the call is async. ignored in phase 1
    int64 timeout = 2;          // in ms
    string command = 3;         // call command. ignored in phase 1
    Data param = 4;             // call input param
}
// general message for a call response
// todo: merge call response with Return Status
message CallResponse {
    ReturnStatus returnStatus = 1;      // return status
    Data result = 2;                    // call result
}
message Job {
    string jobId = 1;
    string name = 2;
}
message Task {
    Job job = 1;
    int64 taskId = 2;
    int64 tableId = 3;
}
// reserved for driver async call result
message Result {
    Task task = 1;
    int64 resultId = 2;
}
// generic return status
message ReturnStatus {
    int32 code = 1;
    string message = 2;
}

proxy.proto:

syntax = "proto3";

import "basic-meta.proto";

package com.webank.ai.fate.api.networking.proxy;

// metadata of event
message Model {
    string namespace = 1;
    string tableName = 2;
}

// metadata of task
message Task {
    string taskId = 1;
    Model model = 2;
}

message Topic {
    string name = 1;
    string partyId = 2;
    string role = 3;
    com.webank.ai.fate.api.core.Endpoint callback = 4;  // implication of pub/sub model, necessary for http-based senario
}

// task admin command
message Command {
    string name = 1;
}

message Conf {
    int64 overallTimeout = 1;           // total timeout, in ms
    int64 completionWaitTimeout = 2;    // timeout for waiting for complete, in ms
    int64 packetIntervalTimeout = 3;    // timeout for packet interval, in ms
    int32 maxRetries = 4;
}

// metadata used for network data transfer
message Metadata {
    Task task = 1;                      // task description
    Topic src = 2;                      // source topic
    Topic dst = 3;                      // destincation topic
    Command command = 4;                // task managing command (if any)
    string operator = 5;                // model operator
    int64 version = 6;                      // 接口版本
    int64 ack = 7;                      // stream ack (reserved)
    Conf conf = 8;                      // operation config
}

// includes key and value field, supporting sequential and random data transfer
message Data {
    string key = 1;     // compatible with list / dict
    bytes value = 2;    // actual value
}

// authentication info
message AuthInfo {
    int64 timestamp = 1;   // timestamp of request, millisecond
    string appKey = 2;
    string signature = 3;    // signature
    string applyId = 4;
    string nonce = 5;
    string version = 6;
    string serviceId = 7;
}

// data streaming packet
message Packet {
    Metadata header = 1;    // packet header
    Data body = 2;          // packet body
    AuthInfo auth = 3;      // authentication info, optional
}





// data transfer service
service DataTransferService {

    rpc unaryCall (Packet) returns (Packet);
}

Command line arguments / config List all command line arguments or config properties command:

./ghz --insecure -i proto/ --proto proxy.proto --call com.webank.ai.fate.api.networking.proxy.DataTransferService.unaryCall -D ./temp.json -c 10 -n 20 --rps 10 127.0.0.1:8001

temp.json:

	"header": {
		"task": {
			"model": {
				"name": "guest-20040#host-10030#model",
				"dataKey": "20220331171539905"
			}
		},
		"src": {
			"name": "partnerPartyName",
			"partyId": "20000",
			"role": "serving"
		},
		"dst": {
			"name": "partyName",
			"partyId": "10000",
			"role": "serving"
		},
		"command": {
			"name": "federatedInference"
		},
		"operator": "111"
	},
	"body": {
		"value": "{\\\"seqno\\\":\\\"748049b4b9544aa6b67be918ded2f716\\\",\\\"featureData\\\":{},\\\"sendToRemoteFeatureData\\\":{},\\\"caseid\\\":\\\"effb644385154fc88ecc7e66951dc857\\\"}"
	},
	"auth": {
		"applyId": "20220331171539905",
		"nonce": "9be609552a02484bb0a8d9f7835168b0",
		"version": "111",
		"serviceId": "service_1"
	}
}

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen. Error creating message from data. illegal base64 data at input byte 0

Environment

  • OS: CentOS Linux release 7.2.1511 (Core)
  • ghz: v0.108.0

Screenshots If applicable, add screenshots to help explain your problem. image

Additional context Add any other context about the problem here.

pizhicheng avatar Apr 20 '22 13:04 pizhicheng

+1

zuston avatar Jul 24 '22 02:07 zuston

For protubuf fields that are bytes I had to base64 encode them in the input JSON (e.g. echo "myval" | base64) to get around this error.

copland avatar Dec 23 '22 15:12 copland