-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Sometimes a double value is not serialized #509
Comments
Can you provide any other details? It's going to be pretty hard to do anything with this bug report without a reproducible test case, or at least some kind of description of what might be unique in the situation where you've noticed a problem. |
Yes I know. There is nothing special. The value is supposed to have been
0.5 likely. It is not supposed to be nan. We might do some more attempts to
reproduce it. If so I will update with results.
/ Kenneth
Den tors 21 nov. 2019 03:37Eric Haszlakiewicz <notifications@github.com>
skrev:
… Can you provide any other details? It's going to be pretty hard to do
anything with this bug report without a reproducible test case, or at least
some kind of description of what might be unique in the situation where
you've noticed a problem.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#509?email_source=notifications&email_token=ABBYLUE44AXZ7MX5MDNJEFLQUXX6XA5CNFSM4JPQMQ5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEYRQZQ#issuecomment-556865638>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBYLUD7K6PANMZ54GSDKBTQUXX6XANCNFSM4JPQMQ5A>
.
|
Note that if it was really a NaN value (e.g. 0.0/0.0), you'd see |
Ahh ok Good to know.
/ Kenneth
Den fre 22 nov. 2019 06:24Eric Haszlakiewicz <notifications@github.com>
skrev:
… Note that if it was really a NaN value (e.g. 0.0/0.0), you'd see "width":
NaN
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#509?email_source=notifications&email_token=ABBYLUHDZZSVYJ7PBIGEY4DQU5NJHA5CNFSM4JPQMQ5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE4P4BI#issuecomment-557383173>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBYLUGOT2KLM23TTHYTXMTQU5NJHANCNFSM4JPQMQ5A>
.
|
We just got another ticket on this problem today. This time it seems like the floating point value is serialized as the character Y, which causes the parser to complain. ... "Pid": { "kp": Y, "ki": 3.0, "kd": 18.0 } ... |
We are using this function multiple times in our app (possibly in different threads) json_c_set_serialization_double_format("%.3g", JSON_C_OPTION_GLOBAL); with parameter "%.3g", "%.6g" and "%.4g" And it might be that the failing double value is always the first after calling the above function... |
Careful with threading, you shouldn't expect that using the same (portions of the) object tree across different threads is completely safe, especially if more than one thread is serializing at the same time. |
Ok, thanks. We will try using the thread setting. Should work fine for us since we are not sharing json-objects between threads. |
I'm assuming more careful threaded handling has solved your problem. If you still see an issue, and can provide an example, please reopen. |
We made the change last week. Still waiting for final result, but no
problems seen yet afaik.
Den ons 11 dec. 2019 kl 04:59 skrev Eric Haszlakiewicz <
notifications@github.com>:
… I'm assuming more careful threaded handling has solved your problem. If
you still see an issue, and can provide an example, please reopen.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#509?email_source=notifications&email_token=ABBYLUCWH3IFRXZ5QN6OJSDQYBQS5A5CNFSM4JPQMQ5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGRZSKQ#issuecomment-564369706>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBYLUDZCEFVIYVZLLV6WKLQYBQS5ANCNFSM4JPQMQ5A>
.
|
It has worked quite well since we made the thread change above, but today I received a report that one double value <51.0> had been encoded as just "51" in the string. In effect one double in an array of eight doubles was encoded in the string as if it had been an integer. Could this happen? |
If you're using a very old version of json-c, yes, but the most recent release (0.15) always adds a ".0", and I think anything starting from 0.13 should be fine. If you have a reproducible test case, please open a new bug and provide it. |
We're using 0.13.1
Den fre 7 aug. 2020 kl 16:31 skrev Eric Hawicz <notifications@github.com>:
… If you're using a very old version of json-c, yes, but the most recent
release (0.15) always adds a ".0", and I think anything starting from 0.13
should be fine. If you have a reproducible test case, please open a new bug
and provide it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#509 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBYLUGOH7O7MDZNFJRJCUDR7QF2HANCNFSM4JPQMQ5A>
.
|
I parsed the "[50.0, 1.00, 63.1, 0.0]" and get the same array in master branch and 0.13.1. How about providing a test case? |
We have seen twice now error messages where json-c has failed parsing a json file written by the same app (and thus json-c). In both cases the files got invalid syntax, as one double value had not been serialized, like the missing width value in the example below.
.... “size”: { “width”: , “height”: 0.5 }, ....
It happens very seldom, and was detected by automated testing in both cases.
The text was updated successfully, but these errors were encountered: