Skip to content

[Bug] [Postgres CDC] postgresSQL database connection leak #2980

@ic4y

Description

@ic4y

Search before asking

  • I searched in the issues and found nothing similar.

Flink version

any

Flink CDC version

master branch

Database and its version

any

Minimal reproduce step

Generating a large number of snapshotSplits during the snapshot synchronization phase can reproduce this issue.

What did you expect to see?

A small number of connections.

What did you see instead?

Abnormal Increase in Connection Count。

select client_addr,count(1) from pg_stat_activity group by client_addr

Anything else?

https://github.com/ververica/flink-cdc-connectors/blob/557944488bf7e1d383365a16c68fac311989e7d8/flink-cdc-connect/flink-cdc-source-connectors/flink-connector-postgres-cdc/src/main/java/com/ververica/cdc/connectors/postgres/source/fetch/PostgresSourceFetchTaskContext.java#L193-L199

This code segment is executed once for each shard, which leads to the creation of a new connection each time and results in a leak.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions