We use Robot Framework for test automation, and our jython test code spawns a java subprocess using subprocess.Popen():
cmd = "java -jar program.jar"
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
process.wait()
Java code utilizes a JDBC connection to Oracle database, and the same program needs to be executed several times successively.
Our issue is, that after the java program exits the database connection to Oracle is not closed - and after several executions the tests start to fail because Oracle won't accept more connections.
netstat shows, that the stale TCP connections to Oracle are owned by jython's PID (=parent process).
Why aren't the connections closed when the java program (=subprocess) exits?