Skip to content

Commit 0feb120

Browse files
authored
fix OOM problem when receive big response of SSE interface from backend (#5148)
1 parent af1104d commit 0feb120

7 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎.github/workflows/checkstyle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
jobs:
2727
checkstyle:
2828
timeout-minutes: 60
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
3030
steps:
3131
- uses: actions/checkout@v3
3232
- name: Set up jdk

‎.github/workflows/maven.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
build:
3030

3131
timeout-minutes: 60
32-
runs-on: ubuntu-latest
32+
runs-on: ubuntu-24.04
3333

3434
steps:
3535
- uses: actions/checkout@v3

‎.github/workflows/rat_check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
jobs:
3030
rat_check:
3131
timeout-minutes: 60
32-
runs-on: ubuntu-latest
32+
runs-on: ubuntu-24.04
3333
steps:
3434
- uses: actions/checkout@v3
3535
- name: Set up jdk

‎.github/workflows/spotbugs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
jobs:
2727
spotbugs:
2828
timeout-minutes: 60
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
3030
steps:
3131
- uses: actions/checkout@v3
3232
- name: Set up jdk

‎.github/workflows/unit-test-jdk17.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
jobs:
2828
unit-tests:
2929
timeout-minutes: 60
30-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-24.04
3131
steps:
3232
- uses: actions/checkout@v3
3333
- name: Set up jdk

‎.github/workflows/unit-test-jdk21.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
jobs:
2828
unit-tests:
2929
timeout-minutes: 60
30-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-24.04
3131
steps:
3232
- uses: actions/checkout@v3
3333
- name: Set up jdk

‎common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/produce/ProduceEventStreamProcessor.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ private void processStringLine(String line) {
325325

326326
private byte[] readALineOfBytesFromBuffer(ByteBuf buffer) {
327327
matchingDelimiterIndex = 0;
328+
int newLineStartPos = buffer.readerIndex();
328329
try (final ByteArrayOutputStream bos = new ByteArrayOutputStream(buffer.readableBytes())) {
329330
while (buffer.readableBytes() > 0 && matchingDelimiterIndex < lineDelimiterBytes.length) {
330331
final byte b = buffer.readByte();
@@ -336,7 +337,7 @@ private byte[] readALineOfBytesFromBuffer(ByteBuf buffer) {
336337
if (matchingDelimiterIndex < lineDelimiterBytes.length) {
337338
// The newline character was not matched, so this part of the buffer does not constitute a complete line of
338339
// content and needs to remain in the buffer, waiting for the next segment to arrive for processing.
339-
buffer.writeBytes(bos.toByteArray());
340+
buffer.readerIndex(newLineStartPos);
340341
return null;
341342
}
342343
matchingDelimiterIndex = 0;

0 commit comments

Comments
 (0)