-
Notifications
You must be signed in to change notification settings - Fork 29
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
Crash when Jemalloc pool is used with BA_PROVIDER #903
Comments
Ref: oneapi-src#903 Signed-off-by: Lukasz Dorau <[email protected]>
I just checked how it works with the OS provider on Ubuntu 22.04:
As you can see there are two |
With jemalloc v5.3.0:
it does not crash:
|
It is the same what I see on the Ubuntu 24.04. But still there is an issue. Even the test did not crash the jemalloc makes 2 allocations from the provider but return back only one. As a result we have the following error in the log:
If I remember in the past we had an assert if tracker is not empty for the pool. @ldorau did we change the logic of this check? |
Yes, there was an assert and it was removed:
|
But again, it is a memory leak and we just deleted an assert that detected this leak instead of trying to fix the issue itself. |
Just a note: having the assertion there was wrong, in my opinion. In general, we shouldn't force the application to not have any leaks. We can produce some logs or enable checking for leaks under some option (or, ideally, just properly support memcheck and asan), but by default, we should not assert/crash. |
In general, I agree that we should not force applications to not have memory leaks. But two thoughts from my side regarding this particular case:
BTW, do we understand why jemalloc behaves in such way? |
From what I remember, this assert will be triggered if an application does not free all allocations prior to calling pool/provider destroy, so this is not only a check for internal consistency. |
In that case I agree. |
Environment Information
Please provide a reproduction of the bug:
I have created PR #902 as a reproducer for this bug.
How often bug is revealed:
The bug is always reproduced on Ubuntu 22.04.4, but works fine on Ubuntu 24.04.1. Probably it is caused by different versions of
libjemalloc
library.Actual behavior:
Tests are crashed with SEGFAULT. The reason is that the jemalloc pool calls memory provider with an invalid pointer and an internal check of the base allocator caught this.
Here is an output of the test enabled in the PR #902 with UMF logs.
Run on the Ubuntu22.04.4:
The jemalloc pool does two allocations from memory provider (see
umfMemoryTrackerAdd
in the log). AS a result it gets two buffers:ptr=0x7ff9717ff000, size=2097152
andptr=0x7ff9741e7000, size=4096
. At the end of the test, the jemalloc pool deallocates these buffers (seeumfMemoryTrackerRemove
), but one of the pointers is incorrect:[ERROR UMF] umfMemoryTrackerRemove: pointer 0x7ff971a00000 not found in the map
.Run on the Ubuntu 24.04.01:
As you can see on the Ubuntu 24.04.01 tests passed. But there is only one deallocation (see
umfMemoryTrackerRemove
) while jemalloc still allocates two buffers (seeumfMemoryTrackerAdd
).Expected behavior:
Test with BA_PROVIDER should pass
Details
Additional information about Priority and Help Requested:
I think there is an issue with
libjemalloc
. Need to confirm. If so, we need to fix our CI to use appropriate version oflibjemalloc
.Requested priority: High. It blocks PR #901
The text was updated successfully, but these errors were encountered: