Skip to content
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

Why am I encountering an issue with the GDS library on a Neo4j Docker container on Windows, despite it working on Linux? #429

Open
studyVersion opened this issue Mar 3, 2023 · 6 comments
Assignees

Comments

@studyVersion
Copy link

I'm running a Neo4j container with the GDS library installed using the following command:

docker run --name testneo4j -p 7474:7474 -p 7687:7687 -v /path/to/neo4j/data:/data -e NEO4J_AUTH=neo4j/12345678 --env NEO4J_PLUGINS='["graph-data-science"]' -d neo4j:latest

On Linux, the query RETURN gds.version() works fine, indicating that the library is installed properly. However, when I run the same query on Windows 11, I get the following error:

Neo.ClientError.Statement.SyntaxError Unknown function 'gds.version' (line 1, column 8 (offset: 7)) "EXPLAIN return gds.version()" ^

I'd like to avoid using a virtual machine and run the container on my localhost instead. Does anyone have an idea what's causing this issue and how to resolve it?

@jennyowen
Copy link
Member

jennyowen commented Mar 3, 2023

It sounds like docker for windows isn't loading the GDS plugin properly.
Can you run the same run command with -e NEO4J_DEBUG=yes added and send the output from the startup attempt on docker for windows?

Docker for windows/mac runs in a virtual machine and that can introduce weird runtime conditions.

@studyVersion
Copy link
Author

studyVersion commented Mar 3, 2023

@jennyowen Thank you for the reply here is the output:

DEBUGGING ENABLED
Running as root user inside neo4j image
chowning /var/lib/neo4j recursively to neo4j:neo4j
Setting all files in /var/lib/neo4j/conf to permissions 600
checking /logs is writable
checking /data is writable
Warning: Folder mounted to "/data" is not writable from inside container. Changing folder owner to neo4j.
parse error: Invalid numeric literal at line 1, column 20
Setting docker specific configuration overrides
Appended db.tx_log.rotation.retention_policy=100M size to /var/lib/neo4j/conf/neo4j.conf
Appended server.memory.pagecache.size=512M to /var/lib/neo4j/conf/neo4j.conf
Appended server.default_listen_address=0.0.0.0 to /var/lib/neo4j/conf/neo4j.conf
Applying configuration settings that have been set using environment variables.
Removing existing setting for server.directories.logs in /var/lib/neo4j/conf/neo4j.conf
Appended server.directories.logs=/logs to /var/lib/neo4j/conf/neo4j.conf
NEO4J_AUTH has been parsed as user "neo4j", password "12345678", do_reset ""
Making sure /data/dbms is owned by neo4j:neo4j
Setting initial password
gosu neo4j:neo4j neo4j-admin dbms set-initial-password 12345678 --verbose
Executing command line: /opt/java/openjdk/bin/java -cp /var/lib/neo4j/plugins/:/var/lib/neo4j/conf/:/var/lib/neo4j/lib/* -XX:+UseParallelGC -XX:-OmitStackTraceInFastThrow -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -XX:+ExitOnOutOfMemoryError -Djdk.tls.ephemeralDHKeySize=2048 -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.cli.AdminTool dbms set-initial-password 12345678 --verbose
neo4j 5.5.0
VM Name: OpenJDK 64-Bit Server VM
VM Vendor: Eclipse Adoptium
VM Version: 17.0.6+10
JIT compiler: HotSpot 64-Bit Tiered Compilers
VM Arguments: [-XX:+UseParallelGC, -XX:-OmitStackTraceInFastThrow, -XX:+UnlockExperimentalVMOptions, -XX:+TrustFinalNonStaticFields, -XX:+DisableExplicitGC, -Djdk.nio.maxCachedBufferSize=1024, -Dio.netty.tryReflectionSetAccessible=true, -XX:+ExitOnOutOfMemoryError, -Djdk.tls.ephemeralDHKeySize=2048, -XX:FlightRecorderOptions=stackdepth=256, -XX:+UnlockDiagnosticVMOptions, -XX:+DebugNonSafepoints, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/sun.nio.ch=ALL-UNNAMED, -Dlog4j2.disable.jmx=true, -Dfile.encoding=UTF-8]
Configuration files used (ordered by priority):
/var/lib/neo4j/conf/neo4j-admin.conf
/var/lib/neo4j/conf/neo4j.conf

Changed password for user 'neo4j'. IMPORTANT: this change will only take effect if performed before the database is started for the first time.
getting full neo4j run command
exec gosu neo4j:neo4j /opt/java/openjdk/bin/java -cp /var/lib/neo4j/plugins/:/var/lib/neo4j/conf/:/var/lib/neo4j/lib/* -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.server.CommunityEntryPoint --home-dir=/var/lib/neo4j --config-dir=/var/lib/neo4j/conf --console-mode
2023-03-03 11:27:10.227+0000 INFO Starting...
2023-03-03 11:27:11.221+0000 INFO This instance is ServerId{b4c9d072} (b4c9d072-5687-455e-b65a-cb1c07129304)
2023-03-03 11:27:12.574+0000 INFO ======== Neo4j 5.5.0 ========
2023-03-03 11:27:15.371+0000 INFO Bolt enabled on 0.0.0.0:7687.
2023-03-03 11:27:16.485+0000 INFO Remote interface available at http://localhost:7474/
2023-03-03 11:27:16.490+0000 INFO id: E2436B0B26E317A03E630ED87D849A835173CF38AF733E1D22AB7833908DEE0F
2023-03-03 11:27:16.490+0000 INFO name: system
2023-03-03 11:27:16.491+0000 INFO creationDate: 2023-03-03T11:27:13.478Z
2023-03-03 11:27:16.491+0000 INFO Started.

@jennyowen
Copy link
Member

Hmm it looks like it's not even trying to load the plugin. It just gives the error parse error: Invalid numeric literal at line 1, column 20 where the plugin should be loaded. When I tried reproducing the problem on windows, it all worked as expected.

Are you sure you're properly typing out NEO4J_PLUGINS='["graph-data-science"]' and that windows (or your text editor?) isn't introducing weird double quotes? It could be a copy and paste issue.

@studyVersion
Copy link
Author

Just a quick update on my experience with the plugin installation process. Uploading the plugin directly from commands is completely out of the question for now on Windows. I used the following Docker command:

docker run --name testneo4j -p 7474:7474 -p 7687:7687 -v C:\\Users\\YOUR_NAME\\Desktop\\neo4j\\data:/data -v C:\\Users\\YOUR_NAME\\Desktop\\neo4j\\plugins:/plugins -e NEO4J_AUTH=neo4j/12345678 --env NEO4J_PLUGINS='["graph-data-science"]' -d neo4j:latest

While this allowed me to manually create a folder for the plugin i still had to download and paste the .jar file into the plugin directory and finally it worked.
Now the problem is that i encountered an issue when attempting to create a graph using the CALL gds.graph.project() query. Despite trying different variations of the dbms.security.procedures.unrestricted setting, such as dbms.security.procedures.unrestricted=gds.graph.exists and gds.* mounting it to the docker command and manually changing the setting on the neo4j.conf file I consistently received the following error message:

gds.graph.project is unavailable because it is sandboxed and has dependencies outside of the sandbox. Sandboxing is controlled by the dbms.security.procedures.unrestricted setting. Only unrestrict procedures you can trust with access to database internals.
Based on this experience, I believe this is a bug that needs to be addressed. I wanted to bring this to your attention in the hopes that it can be resolved soon. Thank you for your attention to this matter.

@Sandalorian
Copy link

@studyVersion - try adding this to your docker run --env=NEO4J_dbms_security_procedures_unrestricted="gds.*" should do the trick

@VictorAZ12
Copy link

Just a quick update on my experience with the plugin installation process. Uploading the plugin directly from commands is completely out of the question for now on Windows. I used the following Docker command:

docker run --name testneo4j -p 7474:7474 -p 7687:7687 -v C:\\Users\\YOUR_NAME\\Desktop\\neo4j\\data:/data -v C:\\Users\\YOUR_NAME\\Desktop\\neo4j\\plugins:/plugins -e NEO4J_AUTH=neo4j/12345678 --env NEO4J_PLUGINS='["graph-data-science"]' -d neo4j:latest

While this allowed me to manually create a folder for the plugin i still had to download and paste the .jar file into the plugin directory and finally it worked. Now the problem is that i encountered an issue when attempting to create a graph using the CALL gds.graph.project() query. Despite trying different variations of the dbms.security.procedures.unrestricted setting, such as dbms.security.procedures.unrestricted=gds.graph.exists and gds.* mounting it to the docker command and manually changing the setting on the neo4j.conf file I consistently received the following error message:

gds.graph.project is unavailable because it is sandboxed and has dependencies outside of the sandbox. Sandboxing is controlled by the dbms.security.procedures.unrestricted setting. Only unrestrict procedures you can trust with access to database internals. Based on this experience, I believe this is a bug that needs to be addressed. I wanted to bring this to your attention in the hopes that it can be resolved soon. Thank you for your attention to this matter.

Legend, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants