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

Passing int64 losses precision sometimes. #447

Open
jmchn opened this issue Jun 24, 2024 · 0 comments
Open

Passing int64 losses precision sometimes. #447

jmchn opened this issue Jun 24, 2024 · 0 comments

Comments

@jmchn
Copy link

jmchn commented Jun 24, 2024

Proto file(s)
message UUID {
int64 most_significant_bits = 1;
int64 least_significant_bits = 2;
}

Command line arguments / config
ghz --proto .\some.proto --call some.service.method --insecure -d "uuid": {"most_significant_bits": -1472264933949945808, "least_significant_bits": -5032223331569284245}}}}}}" --rps 100 --connections 20 --concurrency 50 -m " --debug debug.out localhost:xxxx

Describe the bug
Just in case someone might have the same issue as I do, if you are use ghz for pressure testing a grpc service whose request has int64 variable in it, you might lose precision when passing in. I tested some smaller numbers and it was fine. I debugged into it and it seems that the json.Unmarshal([]byte(*data), &dataObj) caused it.

To Reproduce
As the setup above.

Expected behavior
Something like this should have been passed to the server.
{"uuid": {"most_significant_bits": -1472264933949945808, "least_significant_bits": -5032223331569284245}

Actual behavior
{"uuid":{"least_significant_bits":-5032223331569284000,"most_significant_bits":-1472264933949945900}
(the bits are weirdly truncated)

Environment

  • OS: Win10 powershell & wsl.
  • ghz: 0.120.0
@jmchn jmchn changed the title Passing int64 losses precision sometime. Passing int64 losses precision sometimes. Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant