-
Notifications
You must be signed in to change notification settings - Fork 592
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(java_binding): fix java binding TLS allocation failure #12862
fix(java_binding): fix java binding TLS allocation failure #12862
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12862 +/- ##
==========================================
+ Coverage 69.14% 69.19% +0.05%
==========================================
Files 1487 1489 +2
Lines 244648 245776 +1128
==========================================
+ Hits 169150 170055 +905
- Misses 75498 75721 +223
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 29 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hi @chenzl25, is this a critical issue that will block the release of v1.3? After v1.3, I think we will switch to the embedded jvm totally. |
This PR doesn't fix the issue, we need further investigations. I think it is not a critical blocker. Yes, we have switched to the embedded jvm totally. |
6da334b
to
7cdf801
Compare
This reverts commit fe6820b.
Can you please explain some context in PR description? |
src/common/Cargo.toml
Outdated
[features] | ||
default = [] | ||
disable_initial_exec_tls = ["tikv-jemalloc-ctl/disable_initial_exec_tls"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will be enabled in the binary level, so all crates will be affected. Maybe you can directly add it here if it's expected.
Line 119 in d2ec83c
tikv-jemalloc-ctl = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "64a2d9" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disable_initial_exec_tls will only be enabled when build java binding, will it still affect rw binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will only be enabled when build java binding
This isn't true, as it's unified by hakari. You need to exclude tikv-jemalloc-ctl
or risingwave_java_binding
completely from hakari if you want to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to enable the disable_initial_exec_tls
feature only when we build the Java dynamic library. In other cases, the default feature is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little explanation: hakari tries to help you use the same feature sets regardless of what pkg you use in cargo build -p <pkg>
, in order to avoid re-compilation. But you want exactly the reverse here: turn on different features for different pkgs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think so, let me try. Not quite familiar with hakari before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, I find java_binding
does not utilize jemalloc at all but suffers from its issue. It might not be be a good idea for common
to depend on jemalloc
.
Note that in this case, there will be two malloc implementations operating in the same process, which will almost certainly result in confusing runtime crashes if pointers leak from one implementation to the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be be a good idea for common to depend on jemalloc.
Storage depends on jemalloc profiling, which has to depend on jemalloc. We may need to remove the profiling from compactor to address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be be a good idea for common to depend on jemalloc.
Storage depends on jemalloc profiling, which has to depend on jemalloc. We may need to remove the profiling from compactor to address this.
+1 to remove it from common (to risingwave_common_heap_profiling
). #11665
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@BugenZhao @xxchan PTAL again~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as it only affects java-binding
I just pushed this alternative solution, which I believe is the better way to solve this issue. |
this LGTM too |
Shall we pick this PR to v1.3? |
It just affects our testing. While considering we might run a test on v1.3 after some cherry-picks, we can cherry-pick this PR to v1.3. |
I checked that the java binding .so only loaded in non embedded jvm mode, so it won't affect the functionality of connector. |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
jemalloc_ctl
will register some global symbols in the Java dynamic library which are unexpected.Based on this issue in jemalloc jemalloc 5.0.1 TLS error: cannot allocate memory in static TLS block jemalloc/jemalloc#1237 this PR tries to enabledisable_initial_exec_tls
this feature when we build the Java dynamic library to solve the problem.Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.