VGalaxies opened a new issue, #2310:
URL: https://github.com/apache/incubator-hugegraph/issues/2310

   ### Bug Type (问题类型)
   
   server status (启动/运行异常)
   
   ### Before submit
   
   - [X] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have 
confirmed and searched that there are no similar problems in the historical 
issue and documents)
   
   ### Environment (环境信息)
   
   - Server Version: 1.0.0 (Apache Release Version)
   - Backend: RocksDB x nodes, HDD or SSD 
   - OS: x86_64 Linux 6.4.3-arch1-2
   
   ### Expected & Actual behavior (期望与实际表现)
   
   When I try to stop the server (by script or in IDEA), the following error 
occurs:
   
   ```plain
   2023-09-14 14:34:00 [gremlin-server-stop] [WARN] o.a.t.g.s.GremlinServer - 
Exception while closing Graph instance [hugegraph]
   java.lang.IllegalStateException: Ensure tx closed in all threads when 
closing graph 'hugegraph'
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:531) 
~[guava-25.1-jre.jar:?]
        at org.apache.hugegraph.util.E.checkState(E.java:64) 
~[hugegraph-common-1.0.0.jar:1.0.0]
        at 
org.apache.hugegraph.StandardHugeGraph.close(StandardHugeGraph.java:971) 
~[hugegraph-core-1.0.0.jar:1.0.0]
        at 
org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$null$7(GremlinServer.java:307)
 ~[gremlin-server-3.5.1.jar:3.5.1]
        at 
java.util.concurrent.ConcurrentHashMap$KeySetView.forEach(ConcurrentHashMap.java:4696)
 ~[?:?]
        at 
org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$stop$8(GremlinServer.java:304)
 ~[gremlin-server-3.5.1.jar:3.5.1]
        at java.lang.Thread.run(Thread.java:829) [?:?]
   ```
   
   This is because after closing, the `refs` in `TinkerPopTransaction` are not 
zeroed:
   
   ```java
   public boolean closed() {
       int refs = this.refs.get();
       assert refs >= 0 : refs;
       return refs == 0;
   }
   ```
   
   By logging the value of `refs`, I noticed that when configuring 
`org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin` as 
`scripts/empty-sample.groovy` in `conf/gremlin-server.yaml`, the `refs` value 
is 1. When configured as `scripts/example.groovy`, the `refs` value is 2. 🤔
   
   Related PRs:
   
   - https://github.com/apache/incubator-hugegraph/pull/2031
   
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   _No response_
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hugegraph.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to