Team_RPCtester created THRIFT-5802:
--------------------------------------
Summary: Inconsistent Validation for transmitted values
Key: THRIFT-5802
URL: https://issues.apache.org/jira/browse/THRIFT-5802
Project: Thrift
Issue Type: Bug
Affects Versions: 0.20.0, 0.19.0
Reporter: Team_RPCtester
*Hi,*
We discover an inconsistent behavior under V20.0 and V19.0 by the following
example.
The thrift file:
{code:java}
namespace java com.example
namespace go commonResource
service DataService {
set<i8> Method_1(1: set<i8> agr_method_1)
}
{code}
When using Go,Py3 and Node.js as the client side(writer) and Node.js as the
server side(reader) with the protocol set to “json” and the transport set to
“framed“. We sent the value [10, 43, 38, 38, -2]to the server, but the server
received differently. The received are respectively nothing, [10, 43, 38, -2]
and [10, 43, 38, 38, -2] from Go,Py3 and Node.js which is unexpected. Here is
the relevant code:We use agr_method_1_0 as the parameter sent to the client
side(writer).
Go client side : It throws an error “[]int8 error writing set field: slice is
not unique back”
{code:java}
set_item_0 := []int8 {10, 43, 38, 38, -2}
re_1, err := dataserviceclient.Method_1(context.Background(),set_item_0)
if err != nil {
fmt.Println("Method_1 receives error ", err, " back")
} else {
fmt.Println("Method_1 receives ", re_1, " back")
}
{code}
py3 client side
{code:java}
agr_method_1 = [10, 43, 38, 38, -2]
try:
re_1 = client.Method_1(agr_method_1)
# re_1: [10, 43, 38, -2]
except Exception as ex:
print(f"Method_1 receives error {ex} back")
{code}
Nodejs client side
{code:java}
const arg_Method_1 = [10, 43, 38, 38, -2];
console.log("Method_1 sends ", arg_Method_1, " end");
try {
const re_1 = await client.Method_1(arg_Method_1);
console.log("Method_1 receives ", re_1, " back");
//re_1 [10, 43, 38, 38, -2]
} catch (error) {
console.log("Method_1 receives error ", error, " back");
}
{code}
Nodejs server:
{code:java}
Method_1: async function(agr_method_1, result) {
console.log("Method_1 receives ", agr_method_1);
result(null, agr_method_1);
}
{code}
The Go client throws an error before transmitting the parameter, indicating
that the items are not unique. The Node.js client transmits the duplicate
values and receives de-duplicated values from the Python server. The Python
client automatically de-duplicates the values and receives the de-duplicated
values. This behavior is inconsistent across the different clients.
Can you help check the issue?
Thank you.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)