Skip to content

read_sql hangs up with MySQL in multi-processing after running for a period of time. #814

@da730

Description

@da730

What language are you using?

Python 3.12

What version are you using?

0.4.3

What database are you using?

MySQL

What dataframe are you using?

Pandas

Can you describe your bug?

In each process I run cx.read_sql() per 5 seconds. Some process will hangs up after running for a period of time. Sometimes this will take 20 minutes, and sometimes hours.

What are the steps to reproduce the behavior?

Here is my code:

processes = []
p = multiprocessing.Process(target =
    run_table1_query, name =
    "run_query_1")
processes.append(p)
p.start()
p = multiprocessing.Process(target =
    run_table1_query, name =
    "run_query_2")
processes.append(p)
p.start()
p = multiprocessing.Process(target =
    run_table1_query, name =
    "run_query_3")
processes.append(p)
p.start()
p = multiprocessing.Process(target =
    run_table2_query, name = "table2_query_1")
processes.append(p)
p.start()
p = multiprocessing.Process(target =
    run_table2_query, name = "table2_query_2")
processes.append(p)
p.start()
p = multiprocessing.Process(target =
    run_table2_query, name = "table2_query_3")
processes.append(p)
p.start()
for p in processes: 
	p.join()

run_table2_query and run_table1_query is the function in which I call cx.read_sql() per 5 seconds.

Database setup if the error only happens on specific data or data type

Table schema and example data

Example query / code

SELECT * FROM my_table where mddate = 20250501

What is the error?

No error occouring, but I got these logs if I set os.environ['RUST_LOG'] = "connectorx=debug,connectorx_python=debug" :

Image

Image

It seems that each time it will hang in different code position.

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