neo4j-contrib / neo4j-apoc-procedures

Awesome Procedures On Cypher for Neo4j - codenamed "apoc"                     If you like it, please ★ above ⇧            
https://neo4j.com/labs/apoc
Apache License 2.0
1.71k stars 494 forks source link

Apoc.cypher.runFile not closing file handle #1695

Closed MartinFix closed 3 years ago

MartinFix commented 4 years ago

I'm using Neo4J desktop 1.3.8 on Neo4J 4.1.1 Enterprise with a local database on a windows NTFS formatted SSD with APOC 4.1.0.2. Running against OpenJDK 11.

When running Apoc.cypher.runFile() it opens and runs all statements as expected, but keeps a file lock on the file so that I cannot delete or rename the file as long as the Neo4J database is running. So I have to stop the database and re-start to make the file accessible again.

In a previous version of Neo4J this didn't happen. The file could be deleted after apoc.cypher.runFile() had been completed.

The new behavior is unexpected for me and slows down my work.

conker84 commented 3 years ago

@MartinFix sorry for the late reply can you please try with this jar? Just unzip it inside <NEO4J_HOME>/plugin dir (don't forget to remove the "old" one) apoc-4.1.0.3-all.jar.zip

Looking forward to hearing from you!

conker84 commented 3 years ago

@MartinFix please use this one: apoc-4.1.0.3-all.jar.zip

MartinFix commented 3 years ago

Thanks for the file. My system has upgraded to Neo4j desktop 1.3.10 and 4.1.3 Enterprise in the meantime. When I unpack the file you attached in the /plugins directory, the database is not coming up any more (see attached log file). I did rename the original apoc-4.1.0.2.jar to _apoc-4.1.0.2.jar and renamed your file to apoc-4.1.0.2.jar. Even when reverting these file changes, the database does not come up any more for some reason (see lower part of the log file). neo4j.log

Trying this with 4.1.1 ends with the same results.

Not sure if I'm doing something wrong on the jar replacement or if this is another issue. I also tried a full wipe and clean install for Neo4j desktop, but all the same.

conker84 commented 3 years ago

you must have just one apoc*.jar in your plugin dir please move the old plugin into another dir

MartinFix commented 3 years ago

I see. My mistake. Did try this and it worked fine now. File handle is being closed as expected. Thanks for getting this fixed ;-)

decentropy commented 2 years ago

I'm having this issue on Neo4j 4.4.8 on Windows.
If I run an apoc query below... it locks the data.json, preventing delete/move/rename

CALL apoc.load.json('data.json') YIELD value RETURN value

I've tried the apoc jar posted above, but database fails to load with that.