-
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
cannot add more than 11 objects. Is this a known issue? #599
Comments
Issue exists in 0.14 but NOT in 0.13.1 |
commit 22870ac introduces the issue |
That's pretty bizarre that simply building static libs would cause this problem. I can confirm that I see the same output you do. Investigating... |
77d935b works @stoeckmann, looks like we missed something in the logic of your changes. |
Found it, condition on line 585 of linkhash.c is backwards:
I'll be pushing a fix shortly. |
…was preventing adding more than 11 objects. Add a test to check for this too.
Thank you Eric! |
Yes, thank you for figuring out and applying a patch directly! |
… that was preventing adding more than 11 objects. Add a test to check for this too.
BTW that ^ commit doesn't fix it, the problem isn't ordering. See #610 |
Created this PoC code to replicate an issue I am seeing in my production code.
as of
45b6416 (HEAD -> master, origin/master, origin/HEAD) Merge branch 'master' of https://github.com/json-c/json-c
It never adds more than 11 objects.
#include <stdio.h>
#include "json.h"
int main() {
int i=1;
char object[10214];
/Creating a json object/
json_object *jobj = json_object_new_object();
for(i=1; i <100; i++){
snprintf(object, 1024, "OBJECT_%d", i);
json_object_object_add(jobj, object, json_object_new_int(i));
printf("Round %d:\r\n", i);
printf("%s\r\n\r\n", json_object_to_json_string(jobj));
}
return 0;
}
I get:
Round 1:
{ "OBJECT_1": 1 }
Round 2:
{ "OBJECT_1": 1, "OBJECT_2": 2 }
Round 3:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3 }
Round 4:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3, "OBJECT_4": 4 }
.......
Round 10:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3, "OBJECT_4": 4, "OBJECT_5": 5, "OBJECT_6": 6, "OBJECT_7": 7, "OBJECT_8": 8, "OBJECT_9": 9, "OBJECT_10": 10 }
Round 11:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3, "OBJECT_4": 4, "OBJECT_5": 5, "OBJECT_6": 6, "OBJECT_7": 7, "OBJECT_8": 8, "OBJECT_9": 9, "OBJECT_10": 10, "OBJECT_11": 11 }
Round 12:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3, "OBJECT_4": 4, "OBJECT_5": 5, "OBJECT_6": 6, "OBJECT_7": 7, "OBJECT_8": 8, "OBJECT_9": 9, "OBJECT_10": 10, "OBJECT_11": 11 }
Round 13:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3, "OBJECT_4": 4, "OBJECT_5": 5, "OBJECT_6": 6, "OBJECT_7": 7, "OBJECT_8": 8, "OBJECT_9": 9, "OBJECT_10": 10, "OBJECT_11": 11 }
........
Round 98:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3, "OBJECT_4": 4, "OBJECT_5": 5, "OBJECT_6": 6, "OBJECT_7": 7, "OBJECT_8": 8, "OBJECT_9": 9, "OBJECT_10": 10, "OBJECT_11": 11 }
Round 99:
{ "OBJECT_1": 1, "OBJECT_2": 2, "OBJECT_3": 3, "OBJECT_4": 4, "OBJECT_5": 5, "OBJECT_6": 6, "OBJECT_7": 7, "OBJECT_8": 8, "OBJECT_9": 9, "OBJECT_10": 10, "OBJECT_11": 11 }
The text was updated successfully, but these errors were encountered: