Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector serialization does not take into account endianness #53

Open
phxnsharp opened this issue Jun 22, 2022 · 1 comment
Open

vector serialization does not take into account endianness #53

phxnsharp opened this issue Jun 22, 2022 · 1 comment
Labels
C++ gRPC Python Tasks related with Python language developments

Comments

@phxnsharp
Copy link

The gRPC protocol is defined as sending over the bytes of arrays directly, but does not take into account endianness. This means the protocol will fail spectacularly (type 3 error, bad data with no error) if the client and server machines have different native endianness.

std::string ansys::grpc::client::GRPCClient::serialize_vector(

vector_as_chunk=arg[tmp_idx:last_idx_chunk].tobytes(),

Unless there is another reason, I recommend using gRPC arrays instead of bytes. gRPC can handle this for us.

@RobPasMue RobPasMue added Python Tasks related with Python language developments gRPC C++ labels Jun 23, 2022
@RobPasMue
Copy link
Member

Yes, I've had to deal with this kind of problems in the past... machine endianness is a good point to take into account. We wanted to test serialization/deserialization of data in this example. But I guess we didn't take that into account. We could probably send the machine's endianness as part of the metadata.

The use of bytes was purposefully intended, since what we usually transmit is chunks of bytes from one machine to another. Using arrays would have been the best solution indeed for this case-scenario, but we wanted to show an example of serialization/deserialization.

@akaszynski do you think we should look into changing the nature of the data from bytes to an array? If so, I'll take care of the implementation.

Your feedback is much appreciated @phxnsharp! The machine endianness was a very good point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ gRPC Python Tasks related with Python language developments
Projects
None yet
Development

No branches or pull requests

2 participants