One Star

MySql Connection Leak

Hi,
I'm using Talend 3.2. I have a number of child jobs that are all called from a parent "controller" job. The controller runs an infinite loop calling each child job in turn.
Each child job requires 1 or more connections to MySql so currently they open their own connection as needed. Some of the jobs simply query MySql for state, other jobs update MySql. I thought that when a child job terminated it would close the connection and free it up. This isn't happening though. What I've found over time is that each child job opens a new connection when its run but doesn't close the connection when it's finished.
Could someone advise whether this is expected behaviour and what the recommended approach is to ensuring connections are opened / closed correctly when jobs terminate?
Thanks,
4 REPLIES
Community Manager

Re: MySql Connection Leak

Hello
In the father job, creating a connection share this connection with child jobs, using a tMysqlCommit to close this connection at the end of job.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: MySql Connection Leak

Thanks.
What about the connection leak though? Am I wrong in thinking that if each child job created a connection the connection should close once the job finishes and returns control to the father job? Managing connections like you propose above (especially doing the commit in the parent job) makes it very hard to follow the logic flow when I have several child jobs all performing updates.
Is there an explicit way of closing a connection once the job ends? I guess I can use commit but that only really makes sense if changes have been made to the db.
Thanks again,
One Star

Re: MySql Connection Leak

bump - anyone?
One Star

Re: MySql Connection Leak

as stated by shong "using a tMysqlCommit to close this connection at the end of job", thus, the close is not automatically done, however you can do it with the component tMysqlCommit.