Skip to content

backpressure not handled #1134

Open
Open
@SebastianTusk

Description

@SebastianTusk

I'm importing data with the following code snippet.

const loadDataQuery = `
    LOAD DATA LOCAL INFILE 'stream' INTO TABLE import_table FIELDS TERMINATED BY '|' LINES STARTING BY '0' TERMINATED BY '\n'
`;
const [loadDataResults] = await connection.query({
    sql: loadDataQuery,
    infileStreamFactory: (path: string) => {
        return loadDataStream;
    }
});

If the data stream produces data very fast the mysql connection's socket has to buffer all this data. This leads to an out of memory error.

It looks like there is code that tries to handle this condition at

const onDrain = () => {
The problem is that the socket never issues any pause events. Backpressure has to be handled by using the return value of writable.write.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions