-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[1.10] Possible thread safety issue in manipulation of doubly linked list of bigval_t? #54963
Comments
Yeah this seems thread unsafe from a quick look. |
We're experimenting with this patch (RelationalAI#160) which basically drops the If it seems a reasonable fix, we're happy to upstream it. |
We could legally keep it if we first checked that it is in the correct bigobj list for the current thread, but that seems fairly slow and expensive when the logic is removed already on master |
Closed by #54967. |
Up to 1.10, we had a
realloc_string
function insrc/gc.c
.If the string we were trying to re-allocate was young and sufficiently large (> 2k bytes),
realloc_string
would do the following sequence of steps:realloc
on old_big_val to grow the string, getting a new string new_big_val.Consider that old_big_val was allocated by thread 1, and thread 2 is the one calling
realloc_string
on it. At the same time, thread 1 is doing an unrelated bigval_t allocation.Unless there is some tricky invariant that makes the doubly linked list thread-safe, seems like having thread 2 unlink one node from thread 1's list of freshly allocated bigval_t, while thread 1 inserts one node into its own list of freshly allocated bigval_t is racy.
The text was updated successfully, but these errors were encountered: