apache / apache/doris-flink-connector

[Bug] Memory was leaked by query

Open
#652 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
385
Forks
279
Avg merge
2d 2h
Merged PRs (30d)
6

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.

### Version

I set up Flink 2.2.0 with Doris connector 26.1.0 in k8s.

### What's Wrong?

When I run a simple query:
```
CREATE TABLE doris_fake_data (
fakeid bigint not null,
another_id bigint not null
) WITH (
'connector' = 'doris',
'fenodes' = 'doris-1.mydomain.com:8030',
'username' = 'username',
'password' = 'password',
'table.identifier' = 'fakedatabase.fake_table',

'source.use-old-api' = 'true',
'doris.deserialize.arrow.async' = 'false',
'doris.deserialize.queue.size' = '1',
'doris.batch.size' = '256',
'doris.request.read.timeout' = '60000',
'doris.request.connect.timeout' = '30000'

-- 'sink.label-prefix' = 'flink-test'
);
```
and whatever I do I get:
```
SELECT count(*)+----+----------------------+
| op | EXPR$0 |
+----+----------------------+

Caused by: java.lang.IllegalStateException: Memory was leaked by query. Memory leaked: (4096)
Allocator(ROOT) 0/4096/4096/2147483647 (res/actual/peak/limit)

at org.apache.doris.shaded.org.apache.arrow.memory.BaseAllocator.close(BaseAllocator.java:477) ~[flink-doris-connector-2.2-26.1.0.jar:26.1.0]
at org.apache.doris.shaded.org.apache.arrow.memory.RootAllocator.close(RootAllocator.java:29) ~[flink-doris-connector-2.2-26.1.0.jar:26.1.0]
at org.apache.doris.flink.serialization.RowBatch.close(RowBatch.java:675) ~[flink-doris-connector-2.2-26.1.0.jar:26.1.0]
at org.apache.doris.flink.serialization.RowBatch.readArrow(RowBatch.java:198) ~[flink-doris-connector-2.2-26.1.0.jar:26.1.0]
at org.apache.doris.flink.source.reader.DorisValueReader.hasNext(DorisValueReader.java:257) ~[flink-doris-connector-2.2-26.1.0.jar:26.1.0]
at org.apache.doris.flink.table.DorisRowDataInputFormat.open(DorisRowDataInputFormat.java:101) ~[flink-doris-connector-2.2-26.1.0.jar:26.1.0]
at org.apache.doris.flink.table.DorisRowDataInputFormat.open(DorisRowDataInputFormat.java:46) ~[flink-doris-connector-2.2-26.1.0.jar:26.1.0]
at org.apache.flink.streaming.api.functions.source.legacy.InputFormatSourceFunction.run(InputFormatSourceFunction.java:90) ~[flink-dist-2.2.0.jar:2.2.0]
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:107) ~[flink-dist-2.2.0.jar:2.2.0]
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:68) ~[flink-dist-2.2.0.jar:2.2.0]
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:346) ~[flink-dist-2.2.0.jar:2.2.0]
[ERROR] Could not execute SQL statement. Reason:
java.lang.IllegalStateException: Memory was leaked by query. Memory leaked: (4096)
Allocator(ROOT) 0/4096/4096/2147483647 (res/actual/peak/limit)
```
this is VERY frustrating.

The parameters in the query were added in different combinations trying to find anything that would work. But nothing works.

### What You Expected?

I expected this simple query to return a number.

### How to Reproduce?

_No response_

### Anything Else?

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the supplied Flink SQL configuration, then inspect RowBatch.java around readArrow and close, followed by DorisValueReader.hasNext. Confirm the query completes without the IllegalStateException and that the Arrow allocator reports no leaked memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.