-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix segmentation fault when using jq in threads #2546
Conversation
@edwardb96 I see, you are right. This is the same issue. I do not mind if my patch is not selected, but what prevents merging one of those? I'm about to include one of them to Fedora and RHEL anyway. Tom |
Hi, thanks both for the PRs, see #2305 for current state of the project |
Let's make sure we review this and related issues/PRs before we release, no? I'll see if I can find time this week. |
Maybe this one should be added to https://github.com/jqlang/jq/milestones/1.7%20release? it's the list i've picked things from. @itchyny wrote about a release plan here #2623 (comment) |
@nicowilliams Thank you. Very appreciated, and I added this to the milestone. |
Thank you, guys for taking care of this issue. Let me know if you need anything from my side. |
@thalman Hi, can you rebase on master? the CI should work better now |
In previous code nomem_handler in jv_alloc.c is called only once and therefore the structure is not initialized for second and following threads. This leads to segmentation fault in multi-threading environment. This patch moves initialization of nomem_handler out of the pthread_once call.
This patch implements test that searches a key in simple json in pthread.
fead966
to
cda0b23
Compare
Do you know if this is a regression? i haven't linked with libjq myself but looking at the jq code it seems to have quite a lot of code to be thread safe, but was is never really tested or it broke at some point? Thanks for adding a test btw! |
The bug is not present in 1.5. It was introduced later on in commit 3f86e97 I would not call that regression. It brings a new functionality that allows different |
Thanks!! |
In previous code nomem_handler in jv_alloc.c is called only once and therefore the structure is not initialized for second and following threads.
This leads to segmentation fault in multi-threading environment.
This patch moves initialization of nomem_handler out of the pthread_once call.
This patch fixes the issue #2545