春季-具有SWI-Prolog的Docker容器因致命错误而终止

我正在开发一个Spring Boot Web应用程序,它使用SWI-Prolog的JPL接口从Java调用Prolog.在开发模式下,一切正常.
当我将其部署到Docker时,通过API对JPL的首次调用运行良好.当我尝试再次调用JPL时,JVM崩溃.

我使用LD_PRELOAD指向libswipl.so

SWI_HOME_DIR也被设置.

LD_LIBRARY_PATH设置为指向libjvm.so

我的控制器功能:

@PostMapping("/rules/testAPI/")
@Timed
public List<String> insertRule() {
    String use_module_http = "use_module(library(http/http_open)).";
    JPL.init();

    Query q1 = new Query(use_module_http);
    if (!q1.hasNext()) {
        System.out.println("Failed to load HTTP Module");
    } else {
        System.out.println("Succeeded to load HTTP Module");
    }

    return null;
}

控制台输出

第一次通话

Succeeded to load HTTP Module

第二次通话

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f31705294b2,pid=16,tid=0x00007f30d2eee700
#
# JRE version: OpenJDK Runtime Environment (8.0_191-b12) (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
# Java VM: OpenJDK 64-Bit Server VM (25.191-b12 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libswipl.so+0xb34b2]  PL_thread_attach_engine+0xe2
#
# Core dump written. Default location: //core or core.16
#
# If you would like to submit a bug report,please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

我将错误日志文件上传到pastebin中. click here

有没有人遇到过同样的问题?有解决办法吗?

请注意,我也使用oracle-java-8进行了检查,但是发生相同的错误.

更新:

@CapelliC答案无效.

最佳答案
我想我会尝试“使用”该术语.例如

Query q1 = new Query(use_module_http);
if (!q1.hasNext()) {
    System.out.println("Failed to load HTTP Module");
} else {
    System.out.println("Succeeded to load HTTP Module:"+q1.next().toString());
    // remember q1.close() if there could be multiple soultions
}

或更好

if ((new Query(use_module_http)).oneSolution() == null) ...

还是更好

if ((new Query(use_module_http)).hasSolution() == false) ...

相关文章

这篇文章主要介绍了spring的事务传播属性REQUIRED_NESTED的原...
今天小编给大家分享的是一文解析spring中事务的传播机制,相...
这篇文章主要介绍了SpringCloudAlibaba和SpringCloud有什么区...
本篇文章和大家了解一下SpringCloud整合XXL-Job的几个步骤。...
本篇文章和大家了解一下Spring延迟初始化会遇到什么问题。有...
这篇文章主要介绍了怎么使用Spring提供的不同缓存注解实现缓...