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

JsonReader is not thread safe #1365

Closed
NLxAROSA opened this issue Sep 15, 2024 · 1 comment
Closed

JsonReader is not thread safe #1365

NLxAROSA opened this issue Sep 15, 2024 · 1 comment
Assignees
Labels
bug Something isn't working ETL
Milestone

Comments

@NLxAROSA
Copy link

The code below parellizes the processing across the number of supplied keys. But StringBuilder is not thread-safe. Causes random ArrayIndexOutOfBoundsExceptions in reactive/multi-threaded environments.

StringBuilder sb = new StringBuilder();
jsonKeysToUse.parallelStream().filter(item::containsKey).forEach(key -> {
sb.append(key).append(": ").append(item.get(key)).append(System.lineSeparator());
});

Most notable with large collections of JSON documents and keys and in reactive environments.

@tzolov tzolov added the bug Something isn't working label Sep 16, 2024
@tzolov tzolov self-assigned this Sep 16, 2024
@tzolov tzolov added the ETL label Sep 16, 2024
@tzolov tzolov added this to the 1.0.0-M3 milestone Sep 16, 2024
@tzolov
Copy link
Contributor

tzolov commented Sep 16, 2024

Thanks @NLxAROSA , just caught the same issue.
The fix is coming shortly.

@tzolov tzolov closed this as completed in 40714c9 Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ETL
Projects
None yet
Development

No branches or pull requests

2 participants