-
Notifications
You must be signed in to change notification settings - Fork 3.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
[Java Client] Fixed the producer OOM if got exception while add message to batch container #12170
Conversation
@codelipenghui @BewareMyPower @eolivelli @merlimat Please take a first look if that change is right. I will add test cases if that's the right way to fix it. |
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java
Outdated
Show resolved
Hide resolved
Could you explain why Generally, for OOM issues, I suggest a fail fast solution. Otherwise, there might be a memory leak somewhere. |
Agree. The return of |
But here it swallows the exception and returns false. What would happen if new messages arrived? |
new messages will start a new journey, it can be add success if memory can be allocated now. |
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.
Do you have details about the exception?
Yes, OutOfDirectMemoryError |
I mean you have mentioned will get an exception from the add method, do you see the exception details? which will help us to better understand the problem. |
a30c82d
to
65c3625
Compare
OutOfDirectMemoryError. As same in my unit test, if |
@codelipenghui @merlimat PTAL |
cdb3562
to
441847e
Compare
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java
Show resolved
Hide resolved
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
* up/master: [pulsar-java-client] Auto-recovery after exception like out of direct memory (apache#12170) Allow to config pulsar client allocator out of memory policy (apache#12200) [Transaction] Fix bugs, Exception thrower by TB::appendBufferToTxn must be ManagedLedgerException. (apache#12376) Bumped version to 2.10.0-SNAPSHOT (apache#12285) [docs][Website] add docs of broker entry metadata (apache#12404) [C++] Use weak ref to ClientConnection for timeout task (apache#12409) fix windows test path probleam (apache#12398) [website][upgrade]feat: home page (apache#12383) [docs] [ISSUE 11526] Update the description of `topic` (apache#12375) [Docs] Add document label check robot (apache#12371) [Admin] Get schema validation enforce add applied. (apache#12349) [Doc] add scope explanations (apache#12380) Fix java doc for MultipleListenerValidator (apache#12389)
….2-chapter-4 * website/branch-2.7.2-chapter-3: Update the nesting of forms in the document [pulsar-java-client] Auto-recovery after exception like out of direct memory (apache#12170) Allow to config pulsar client allocator out of memory policy (apache#12200) [Transaction] Fix bugs, Exception thrower by TB::appendBufferToTxn must be ManagedLedgerException. (apache#12376) Bumped version to 2.10.0-SNAPSHOT (apache#12285) [docs][Website] add docs of broker entry metadata (apache#12404) [C++] Use weak ref to ClientConnection for timeout task (apache#12409) fix windows test path probleam (apache#12398) [website][upgrade]feat: home page (apache#12383) [docs] [ISSUE 11526] Update the description of `topic` (apache#12375) [Docs] Add document label check robot (apache#12371) [Admin] Get schema validation enforce add applied. (apache#12349) [Doc] add scope explanations (apache#12380) Fix java doc for MultipleListenerValidator (apache#12389)
… memory (apache#12170) (cherry picked from commit ee62763) (cherry picked from commit 10301ee)
Add the |
Fixes #15689 Fixes #15793 Fixes #15897 ### Motivation `PulsarByteBufAllocator.DEFAULT` instance was replaced in BatchMessageContainerImplTest, but never restored. This caused strange issues in many unit tests. OutOfMemoryError and NoClassDefFoundErrors were most likely caused by the BatchMessageContainerImplTest. ### Modifications Fix the problems in BatchMessageContainerImplTest and reset the state after the test completes. ### Additional context The flaky test was introduced by #12170 which has been cherry-picked to branch-2.8, branch-2.9 and included also in branch-2.10 .
Fixes #15689 Fixes #15793 Fixes #15897 ### Motivation `PulsarByteBufAllocator.DEFAULT` instance was replaced in BatchMessageContainerImplTest, but never restored. This caused strange issues in many unit tests. OutOfMemoryError and NoClassDefFoundErrors were most likely caused by the BatchMessageContainerImplTest. ### Modifications Fix the problems in BatchMessageContainerImplTest and reset the state after the test completes. ### Additional context The flaky test was introduced by #12170 which has been cherry-picked to branch-2.8, branch-2.9 and included also in branch-2.10 . (cherry picked from commit ef1e0aa)
…he#15911) Fixes apache#15689 Fixes apache#15793 Fixes apache#15897 ### Motivation `PulsarByteBufAllocator.DEFAULT` instance was replaced in BatchMessageContainerImplTest, but never restored. This caused strange issues in many unit tests. OutOfMemoryError and NoClassDefFoundErrors were most likely caused by the BatchMessageContainerImplTest. ### Modifications Fix the problems in BatchMessageContainerImplTest and reset the state after the test completes. ### Additional context The flaky test was introduced by apache#12170 which has been cherry-picked to branch-2.8, branch-2.9 and included also in branch-2.10 . (cherry picked from commit ef1e0aa) (cherry picked from commit 3f3d452)
Motivation
Currently, if
BatchMessageContainerImpl
's add method throw anException
while adding the first messages.Then, the message list is not empty, while the
batchedMessageMetadataAndPayload
is null.The producer can't recovery unless we reboot.
Modifications
Support to recovery after add the first message throws exception
Documentation
bug fix, doesn't need doc