-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apoc.load.jdbcUpdate inside apoc.periodic.iterate leaves idle connections from 5.19 and forward #4141
Labels
Comments
vga91
pushed a commit
to vga91/neo4j-apoc-procedures
that referenced
this issue
Sep 26, 2024
…terate leaves idle connections from 5.19 and forward
vga91
added a commit
that referenced
this issue
Sep 26, 2024
… idle connections from 5.19 and forward
vga91
added a commit
that referenced
this issue
Sep 26, 2024
… idle connections from 5.19 and forward
vga91
added a commit
that referenced
this issue
Sep 26, 2024
… idle connections from 5.19 and forward
vga91
added a commit
that referenced
this issue
Oct 4, 2024
… idle connections from 5.19 and forward
RobertoSannino
pushed a commit
that referenced
this issue
Oct 7, 2024
… idle connections from 5.19 and forward (#4196)
vga91
added a commit
that referenced
this issue
Nov 19, 2024
… idle connections from 5.19 and forward (#4196)
vga91
added a commit
that referenced
this issue
Nov 19, 2024
vga91
added a commit
that referenced
this issue
Dec 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Guidelines
Expected Behavior (Mandatory)
This is issue #4074, but since I cannot reopen it, I am opening a new issue.
When running a apoc.load.jdbcUpdate operation as the second statement in an apoc.periodic.iterate, the connections to the database (postgres) should be closed after they have been executed.
This specifically happened when 5.19 was released. It still works in 5.18.
The previous PR suggested that this was a driver problem and not a problem with apoc. But changing the postgres driver doesn't do anything: in 5.18 everything works fine and from 5.19 onwards it does not work. So a change that breaks this functionality was introduced in 5.19. It should be possible to isolate the breaking change.
Actual Behavior (Mandatory)
It does not close the connections, and it leaves an idle connection for each statement. When the postgres database reaches max connections the statement fails.
How to Reproduce the Problem
Steps (Mandatory)
CREATE TABLE nodes ( id serial PRIMARY KEY, my_id integer );
WITH range(0, 100) as list UNWIND list as l CREATE (n:MyNode{id: l})
CALL apoc.load.driver("org.postgresql.Driver")
CALL apoc.periodic.iterate("MATCH (n:MyNode) return n", "WITH n, apoc.text.format('insert into nodes (my_id) values (\\\'%d\\\')',[n.id]) AS sql CALL apoc.load.jdbcUpdate('jdbc:postgresql://my_user:my_password@localhost:5432/my_database',sql) YIELD row AS row2 return row2,n", {batchsize: 10,parallel: true}) yield batches,total,timeTaken,committedOperations,failedOperations,failedBatches,retries,errorMessages, operations, failedParams, updateStatistics return batches,total,timeTaken, committedOperations,failedOperations,failedBatches,retries,errorMessages,operations,failedParams, updateStatistics
select client_addr, state from pg_stat_activity to see the hanging connections from the neo4j server. They can be killed with select pg_terminate_backend(pid) from pg_stat_activity where state = 'idle' but a pg_cancel_backend will not work.
Specifications (Mandatory)
Currently used versions
Versions
The text was updated successfully, but these errors were encountered: