Java程序连接nebula一段时间后,就会管道破裂

  • nebula 版本:v3.2.0
  • 部署方式:单机
  • 安装方式:RPM
  • 是否为线上版本:Y
  • 硬件信息
    • 磁盘( HDD)
    • CPU、内存信息
  • Java程序连接nebula一段时间后,就会管道破裂

刚开始是可以查询的,后面就会报连接异常


连接代码如下:


尝试过每次查询完session.release(); 但无法重新获取新的

第一次session.release()
下次查询会报The session was released, couldn’t use again
按理调用session.execute会从pool再拿一个新的session吧,不明白为什么会报这个

参考下这个帖子呢:thinking:nebula-java使用问题,项目开启一段时间后会管道破裂,无法查到数据,只能重启恢复 - #10,来自 steam

我按照这篇帖子中session release后会报The session was released, couldn’t use again.

[ERROR] 2022-11-03 17:46:00.972 logback [http-nio-28343-exec-10] com.dimpt.display.controller.JmrSocController : getIpTraceabilityInfo方法查询出错,错误日志:{}
com.vesoft.nebula.client.graph.exception.IOErrorException: The session was released, couldn't use again.
        at com.vesoft.nebula.client.graph.net.Session.executeJsonWithParameter(Session.java:265)
        at com.vesoft.nebula.client.graph.net.Session.executeJson(Session.java:198)
        at com.dimpt.display.service.impl.JmrNebulaServiceImpl.executeJson(JmrNebulaServiceImpl.java:42)
        at com.dimpt.display.service.impl.JmrNebulaServiceImpl.getIpTraceabilityInfo(JmrNebulaServiceImpl.java:35)
        at com.dimpt.display.controller.JmrSocController.getIpTraceabilityInfo(JmrSocController.java:219)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

你如果执行完release了, 再次执行时要重新getSession

原本以为再次调用session会重新执行getSession这个方法
`@Component
public class NebulaSession {

@Autowired
private NebulaPool nebulaPool;
@Autowired
private NebulaGraphProperties nebulaGraphProperties;



@Bean
public Session session() throws Exception {
    return nebulaPool.getSession(nebulaGraphProperties.getUserName(),nebulaGraphProperties.getPassword(),false);
}

}
`
后面又手动引用了下 可以了
session = nebulaSession.session();

此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。