Skip to content

Cannot restart gremlin-server enabled database with preexisting database. #213

Closed

Description

@michaelawarren

ArcadeDB Version: ArcadeDB Server v21.11.1-SNAPSHOT (build 494adfa/1637138916067/main)

JDK Version: ?? What ever is on the docker image

OS: Whatever is on the docker image

Expected behavior

Server to start up normally

Actual behavior

First run
image

second run or with defaults server startup logs

[main] WARN org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager - Graph [graph] configured at [../config/gremlin-server.properties] could not be instantiated and will not be available in Gremlin Server.  GraphFactory message: GraphFactory could not instantiate this Graph implementation [class org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph]
java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph]
        at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:84)
        at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:72)
        at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:106)
        at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.addGraph(DefaultGraphManager.java:63)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
        at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.<init>(DefaultGraphManager.java:58)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:84)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:124)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:87)
        at com.arcadedb.server.gremlin.GremlinServerPlugin.startService(GremlinServerPlugin.java:77)
        at com.arcadedb.server.ArcadeDBServer.registerPlugins(ArcadeDBServer.java:187)
        at com.arcadedb.server.ArcadeDBServer.start(ArcadeDBServer.java:132)
        at com.arcadedb.server.ArcadeDBServer.main(ArcadeDBServer.java:89)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:80)
        ... 16 more
Caused by: com.arcadedb.exception.DatabaseOperationException: Error on creating new database instance
        at com.arcadedb.database.EmbeddedDatabase.openInternal(EmbeddedDatabase.java:1647)
        at com.arcadedb.database.EmbeddedDatabase.open(EmbeddedDatabase.java:184)
        at com.arcadedb.database.DatabaseFactory.open(DatabaseFactory.java:73)
        at com.arcadedb.database.DatabaseFactory.open(DatabaseFactory.java:65)
        at org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph.<init>(ArcadeGraph.java:91)
        at org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph.open(ArcadeGraph.java:118)
        ... 21 more
Caused by: com.arcadedb.utility.LockException: Database 'graph' is locked by another process (path=/home/arcadedb/databases/graph)
        at com.arcadedb.database.EmbeddedDatabase.lockDatabase(EmbeddedDatabase.java:1493)
        at com.arcadedb.database.EmbeddedDatabase.checkForRecovery(EmbeddedDatabase.java:1586)
        at com.arcadedb.database.EmbeddedDatabase.openInternal(EmbeddedDatabase.java:1625)
        ... 26 more
Caused by: java.nio.channels.OverlappingFileLockException
        at java.base/sun.nio.ch.FileLockTable.checkList(FileLockTable.java:229)
        at java.base/sun.nio.ch.FileLockTable.add(FileLockTable.java:123)
        at java.base/sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1154)
        at java.base/java.nio.channels.FileChannel.tryLock(FileChannel.java:1165)
        at com.arcadedb.database.EmbeddedDatabase.lockDatabase(EmbeddedDatabase.java:1474)
        ... 28 more

Steps to reproduce

  1. Run the docker command without default first time things will start up and be queryable via gremlin api. But not the arcade db UI. (http://localhost:2480/#)
  2. run docker rm -f graphdb and then the docker command below. Stack trace mentioned above will show. The database graph will be available via the UI but not gremlin api.

if ran with -e "arcadedb.server.defaultDatabases=graph[root]" the graph will return the above stacktrace but the database graph will be available in the ui.

docker command without default

# powershell
docker run -d --name graphdb `
-p 2424:2424 -p 2480:2480 -p 8182:8182 `
    -v $PWD/config:/home/arcadedb/config `
    -v $PWD/data:/home/arcadedb/databases `
    -e "arcadedb.server.rootPassword=playwithdata" `
    -e arcadedb.server.plugins=GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin `
    arcadedata/arcadedb:latest

docker logs

docker logs --tail 1000 -f graphdb

gremlin-server.groovy

import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook

def globals = [:]

// defines a sample LifeCycleHook that prints some output to the Gremlin Server console.
// note that the name of the key in the "global" map is unimportant.
globals << [hook : [
        onStartUp: { ctx ->
            ctx.logger.info("Executed once at startup of Gremlin Server.")
        },
        onShutDown: { ctx ->
            ctx.logger.info("Executed once at shutdown of Gremlin Server.")
        }
] as LifeCycleHook]

// define the default TraversalSource to bind queries to - this one will be named "g".
globals << [graph : graph.traversal()]

gremlin-server.properties

gremlin.graph=org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph
gremlin.arcadedb.directory=/home/arcadedb/databases/graph

Activity

  1. lvca commented on Nov 18, 2021

    @lvca
    Member

    Thanks for opening this issue. First of all, I just realized the new gremlin-server.* files are not included in the distribution (and therefore docker), but they should provide a basic standard cfg, so I've just added them as b45821f. About the database I guess the issue with the server is that it demands to have the database under the server's databases directory, but I'm not sure the graph is created there from the Gremlin Server. I'm gonna test this more.

  2. michaelawarren commented on Dec 1, 2021

    @michaelawarren
    Author

    Is there any update on this?

  3. lvca commented on Dec 1, 2021

    @lvca
    Member

    Hi @michaelawarren, I had lost track of this issue, but I pushed a bunch of fixes for the Gremlin Server that should have resolved the problem. Please let me know if you can find further issues with the Gremlin Server.

  4. michaelawarren commented on Dec 1, 2021

    @michaelawarren
    Author

    This problem still persists as described.

  5. lvca commented on Dec 2, 2021

    @lvca
    Member

    @michaelawarren thanks, checking it right now.

  6. lvca commented on Dec 2, 2021

    @lvca
    Member

    Reproduced.

  7. lvca commented on Dec 3, 2021

    @lvca
    Member

    Hi,
    The default path of server-gremlin.yaml contained the wrong path for both groovy and properties file.

    Please use the latest docker image and start it with:

    docker run -d --name graphdb -p 2424:2424 -p 2480:2480 -p 8182:8182 -e "arcadedb.server.rootPassword=playwithdata" -e arcadedb.server.plugins=GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin -e "arcadedb.server.defaultDatabases=graph[root]"  arcadedata/arcadedb:latest
    
    
     █████╗ ██████╗  ██████╗ █████╗ ██████╗ ███████╗██████╗ ██████╗
    ██╔══██╗██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔════╝██╔══██╗██╔══██╗
    ███████║██████╔╝██║     ███████║██║  ██║█████╗  ██║  ██║██████╔╝
    ██╔══██║██╔══██╗██║     ██╔══██║██║  ██║██╔══╝  ██║  ██║██╔══██╗
    ██║  ██║██║  ██║╚██████╗██║  ██║██████╔╝███████╗██████╔╝██████╔╝
    ╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚═════╝ ╚══════╝╚═════╝ ╚═════╝
    PLAY WITH DATA                                    arcadedb.com
    
    2021-12-02 22:06:23.818 INFO  [ArcadeDBServer] <ArcadeDB_0> ArcadeDB Server v21.12.1-SNAPSHOT (build e0e07a703f25725694d18b55d8387444d18e4e1b/1638482697263/main) is starting up...
    2021-12-02 22:06:23.821 INFO  [ArcadeDBServer] <ArcadeDB_0> Starting ArcadeDB Server with plugins [GremlinServer] ...
    2021-12-02 22:06:23.884 INFO  [ArcadeDBServer] <ArcadeDB_0> - JMX Metrics Started...
    2021-12-02 22:06:24.031 INFO  [ServerSecurity] <ArcadeDB_0> Creating root user with the provided password
    2021-12-02 22:06:24.449 INFO  [ArcadeDBServer] <ArcadeDB_0> Creating default database 'graph'...[main] INFO org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager - Graph [graph] was successfully configured via [../config/gremlin-server.properties].
    [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
    [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/arcadedb/lib/groovy-2.5.14-indy.jar) to method java.lang.Object.finalize()
    WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
    [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - A GraphTraversalSource is now bound to [graph] with graphtraversalsource[arcadegraph[graph], standard]
    [main] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the standard OpProcessor.
    [main] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the session OpProcessor.
    [main] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the traversal OpProcessor.
    [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executing start up LifeCycleHook
    [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executed once at startup of Gremlin Server.
    [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - idleConnectionTimeout was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
    [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - keepAliveInterval was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
    [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.graphbinary-v1.0 with org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1
    
    2021-12-02 22:06:31.187 INFO  [ArcadeDBServer] <ArcadeDB_0> - GremlinServer plugin started
    2021-12-02 22:06:31.188 INFO  [HttpServer] <ArcadeDB_0> - Starting HTTP Server (host=0.0.0.0 port=2480-2489)...[gremlin-server-boss-1] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Gremlin Server configured with worker thread pool of 1, gremlin pool of 4 and boss thread pool of 1.
    [gremlin-server-boss-1] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Channel started at port 8182.
    
    2021-12-02 22:06:31.300 INFO  [undertow] starting server: Undertow - 2.2.13.Final
    2021-12-02 22:06:31.330 INFO  [xnio] XNIO version 3.8.4.Final
    2021-12-02 22:06:31.361 INFO  [nio] XNIO NIO Implementation Version 3.8.4.Final
    2021-12-02 22:06:31.432 INFO  [threads] JBoss Threads version 3.1.0.Final
    2021-12-02 22:06:31.554 INFO  [HttpServer] <ArcadeDB_0> - HTTP Server started (host=0.0.0.0 port=2480)
    2021-12-02 22:06:31.565 INFO  [ArcadeDBServer] <ArcadeDB_0> Available query languages: [mongo, gremlin, cypher, sql]
    2021-12-02 22:06:31.567 INFO  [ArcadeDBServer] <ArcadeDB_0> ArcadeDB Server started (CPUs=4 MAXRAM=2.00GB)
    
  8. self-assigned this
    on Dec 3, 2021
  9. michaelawarren commented on Dec 7, 2021

    @michaelawarren
    Author

    @lvca looks like the gremlin server is now working without errors with the instructions you have given me using the latest docker image. I'm still seeing some odd behavior though.

    1. When I create data using the gremlin-server interface it doesn't show up in the UI.
      1. Start up docker as instructed
      2. Using java application execute command to create vertex
      var cluster = Cluster.build().enableSsl(false).addContactPoint("localhost").port(8182).credentials("root", "playwithdata").serializer(createSerializer()).create()
      var g = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using(createCluster(), "graph"));
      g.addV().property("myProp", "some value").next(); // creates the vertex
      g = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using(createCluster(), "graph"));
      g.V().valueMap().with(WithOptions.tokens).toList(); // verifies that the vertex created with properties is returned
      1. Login into ui at http://localhost:2480/
      2. Use ui to run command to select all vertex g.V()
        image
      3. Result of ui is no vertex to be shown
      4. Also looks like there are no vertex or edge schemas create
        image
    2. When I try to restart the server using -v /data:/home/arcadedb/databases data i created is not preserved even through the gremlin-server interface.
      1. start up docker with volumn for databases
      docker run -d --name arcadedb `
       -p 2424:2424 -p 2480:2480 -p 8182:8182 `
       -v $PWD/data:/home/arcadedb/databases `
       -e arcadedb.server.rootPassword=rootpwd123 `
       -e arcadedb.server.plugins=GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin `
       -e "arcadedb.server.defaultDatabases=graph[root]" `
       arcadedata/arcadedb:latest
      
      1. create data using same pattern as step 1 - ii
      2. results will be returned
      3. restart database
      4. query for vertex like last line in step 1 - ii
      5. no results are returned
  10. lvca commented on Dec 14, 2021

    @lvca
    Member

    Reproduced. The Gremlin API creates a graph database under the directory bin/databases of the container. Working on a fix.

  11. added a commit that references this issue on Dec 14, 2021
  12. lvca commented on Dec 14, 2021

    @lvca
    Member

    The issue was with the default gremlin-server.properties. I replaced

    gremlin.arcadedb.directory=databases/graph
    

    with

    gremlin.arcadedb.directory=../databases/graph
    

    Pushed the changes, please wait for the docker image to be regenerated.

  13. added this to the 21.12.1 milestone on Dec 14, 2021
  14. lvca commented on Dec 14, 2021

    @lvca
    Member

    The image is public on Docker Hub. Please fetch the latest and let us know. I tested and now work in all the cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Sponsor
    SponsoredKunjungi sekarang
    Promo