[release-1.10] dont reset maxsize in jl_array_to_string#55689
[release-1.10] dont reset maxsize in jl_array_to_string#55689KristofferC merged 1 commit intobackports-release-1.10from
Conversation
|
The issue with this is that it then becomes UB to call |
Not sure if I see why? The |
|
Bump. |
|
Yeah, @oscardssmith I don't think you have that quite right. Is there any chance that you misread things? Can you give it a closer read? As diogo says: in the branch this PR modifies, the data is not being shared, it's being copied. The only reason this branch resets the values in the array is to be consistent with the branch where it is shared. So after this change, that branch will logically clear the array, in all user-visible ways, but it will allow the array to keep accounting for its memory, so that the memory accounting is correct. |
NHDaly
left a comment
There was a problem hiding this comment.
This LGTM. I'm pretty sure this is the right fix, and it resolved the issues from our end.
@oscardssmith if you could give it another look that would be helpful, but i have medium-high confidence in this approach and I'm comfortable approving+merging.
Let's change
jl_array_to_stringso that we make the consequences of calling it in a thread-unsafe way less disastrous (i.e. let's avoid corrupting GC internal metrics).Strictly speaking, this is not a bug-fix because calling
jl_array_to_stringconcurrently from two threads is UB in any case.To see how a race here may lead to negative
live_bytes, consider this MWE from @NHDaly: