OR-TOOLS在运行TSP时出现EXCEPTION_ACCESS_VIOLATION。

huangapple go评论85阅读模式
英文:

OR-TOOLS EXCEPTION_ACCESS_VIOLATION when running TSP

问题

当我运行TSP算法时,我在本机的or-tools库上遇到了致命错误。
在只运行一次时,执行TSP算法成功的机会很小,但在连续执行之后,如果它们之间没有很大的间隔,问题总是会发生。

我目前在Windows 10上运行它,但我也在Debian和Alpine上测试了它,问题仍然存在。

以下是一个预览,但你可以在[这里][1]查看完整的日志(每次出现此错误时,问题帧都不同)。

#
# Java运行时环境检测到了致命错误:
#
# EXCEPTION_ACCESS_VIOLATION(0xc0000005),位置=0x000002a9e261c007,pid=12012,tid=9116
#
# JRE版本:OpenJDK Runtime Environment(14.0.1+7)(构建14.0.1+7)
# Java虚拟机:OpenJDK 64位服务器VM(14.0.1+7,混合模式,共享,分层,压缩的oops,g1 gc,windows-amd64)
# 问题帧:
# J 10298 c2 org.neo4j.kernel.impl.store.LongerShortString.decode([JII)Lorg/neo4j/values/storable/TextValue;(120字节)@ 0x000002a9e261c007 [0x000002a9e261bb80+0x0000000000000487]
#
# 不会写入核心转储。默认情况下,Windows客户端版本不启用小转储
#
# 包含更多信息的错误报告文件已保存为:
# C:\Users\hugo_\Workspace\Itini\Backend\service-itinerary-builder\hs_err_pid12012.log
编译的方法(c2)124037 10298 4 org.neo4j.kernel.impl.store.LongerShortString::decode(120字节)
 堆中的总计 [0x000002a9e261b910,0x000002a9e261cc48] = 4920
 重定位 [0x000002a9e261ba70,0x000002a9e261bb70] = 256
 主代码 [0x000002a9e261bb80,0x000002a9e261c6e0] = 2912
 存根代码 [0x000002a9e261c6e0,0x000002a9e261c6f8] = 24
 oops [0x000002a9e261c6f8,0x000002a9e261c708] = 16
 元数据 [0x000002a9e261c708,0x000002a9e261c770] = 104
 范围数据 [0x000002a9e261c770,0x000002a9e261ca40] = 720
 范围PCS [0x000002a9e261ca40,0x000002a9e261cb90] = 336
 依赖项 [0x000002a9e261cb90,0x000002a9e261cb98] = 8
 处理程序表 [0x000002a9e261cb98,0x000002a9e261cc28] = 144
 空chk表 [0x000002a9e261cc28,0x000002a9e261cc48] = 32
编译的方法(c2)124056 12326 4 org.neo4j.kernel.impl.newapi.DefaultPropertyCursor::propertyValue(38字节)
 堆中的总计 [0x000002a9e2cb7410,0x000002a9e2cb88f8] = 5352
 重定位 [0x000002a9e2cb7570,0x000002a9e2cb7750] = 480
 主代码 [0x000002a9e2cb7760,0x000002a9e2cb8280] = 2848
 存根代码 [0x000002a9e2cb8280,0x000002a9e2cb82c8] = 72
 oops [0x000002a9e2cb82c8,0x000002a9e2cb82d8] = 16
 元数据 [0x000002a9e2cb82d8,0x000002a9e2cb8398] = 192
 范围数据 [0x000002a9e2cb8398,0x000002a9e2cb8618] = 640
 范围PCS [0x000002a9e2cb8618,0x000002a9e2cb8828] = 528
 依赖项 [0x000002a9e2cb8828,0x000002a9e2cb8838] = 16
 处理程序表 [0x000002a9e2cb8838,0x000002a9e2cb88c8] = 144
 空chk表 [0x000002a9e2cb88c8,0x000002a9e2cb88f8] = 48

Java代码:

public List<AlgoNode> solve(final Collection<AlgoNode> nodes, final AlgoNode start) {
     if (nodes == null || nodes.isEmpty())
         return new ArrayList<>();
     if (nodes.size() == 1)
         return new ArrayList<>(nodes);

     // 设置变量
     var list = new ArrayList<>(nodes);
     var depot = start == null ? 0 : list.indexOf(start);
     var manager = new RoutingIndexManager(list.size(), 1, depot);
     var routing = new RoutingModel(manager);

     // 定义虚拟权重函数
     var transitCallbackIndex = routing.registerTransitCallback((fromIndex, toIndex) -> 1L);
     routing.setArcCostEvaluatorOfAllVehicles(transitCallbackIndex);

     // 解决
     var parameters = main.defaultRoutingSearchParameters().toBuilder();
     parameters.setFirstSolutionStrategy(FirstSolutionStrategy.Value.PATH_CHEAPEST_ARC);
     var solution = routing.solveWithParameters(parameters.build()); // 

<details>
<summary>英文:</summary>

When I run the TSP algorithm I get a fatal error on the native or-tools library.
There is a small chance to execute the TSP algo with success when running it only one time, but for consecutive executions without a big interval between them, it always happens.

I&#39;m currently running it on Windows 10, but it tested it on Debian and Alpine and the problem still happens.

Here is a preview, but you can see the full log [here][1] (each time I get this error the problematic frame is different).

    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000002a9e261c007, pid=12012, tid=9116
    #
    # JRE version: OpenJDK Runtime Environment (14.0.1+7) (build 14.0.1+7)
    # Java VM: OpenJDK 64-Bit Server VM (14.0.1+7, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
    # Problematic frame:
    # J 10298 c2 org.neo4j.kernel.impl.store.LongerShortString.decode([JII)Lorg/neo4j/values/storable/TextValue; (120 bytes) @ 0x000002a9e261c007 [0x000002a9e261bb80+0x0000000000000487]
    #
    # No core dump will be written. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # C:\Users\hugo_\Workspace\Itini\Backend\service-itinerary-builder\hs_err_pid12012.log
    Compiled method (c2)  124037 10298       4       org.neo4j.kernel.impl.store.LongerShortString::decode (120 bytes)
     total in heap  [0x000002a9e261b910,0x000002a9e261cc48] = 4920
     relocation     [0x000002a9e261ba70,0x000002a9e261bb70] = 256
     main code      [0x000002a9e261bb80,0x000002a9e261c6e0] = 2912
     stub code      [0x000002a9e261c6e0,0x000002a9e261c6f8] = 24
     oops           [0x000002a9e261c6f8,0x000002a9e261c708] = 16
     metadata       [0x000002a9e261c708,0x000002a9e261c770] = 104
     scopes data    [0x000002a9e261c770,0x000002a9e261ca40] = 720
     scopes pcs     [0x000002a9e261ca40,0x000002a9e261cb90] = 336
     dependencies   [0x000002a9e261cb90,0x000002a9e261cb98] = 8
     handler table  [0x000002a9e261cb98,0x000002a9e261cc28] = 144
     nul chk table  [0x000002a9e261cc28,0x000002a9e261cc48] = 32
    Compiled method (c2)  124056 12326       4       org.neo4j.kernel.impl.newapi.DefaultPropertyCursor::propertyValue (38 bytes)
     total in heap  [0x000002a9e2cb7410,0x000002a9e2cb88f8] = 5352
     relocation     [0x000002a9e2cb7570,0x000002a9e2cb7750] = 480
     main code      [0x000002a9e2cb7760,0x000002a9e2cb8280] = 2848
     stub code      [0x000002a9e2cb8280,0x000002a9e2cb82c8] = 72
     oops           [0x000002a9e2cb82c8,0x000002a9e2cb82d8] = 16
     metadata       [0x000002a9e2cb82d8,0x000002a9e2cb8398] = 192
     scopes data    [0x000002a9e2cb8398,0x000002a9e2cb8618] = 640
     scopes pcs     [0x000002a9e2cb8618,0x000002a9e2cb8828] = 528
     dependencies   [0x000002a9e2cb8828,0x000002a9e2cb8838] = 16
     handler table  [0x000002a9e2cb8838,0x000002a9e2cb88c8] = 144
     nul chk table  [0x000002a9e2cb88c8,0x000002a9e2cb88f8] = 48

Java code:

    public List&lt;AlgoNode&gt; solve(final Collection&lt;AlgoNode&gt; nodes, final AlgoNode start) {
         if (nodes == null || nodes.isEmpty())
             return new ArrayList&lt;&gt;();
         if (nodes.size() == 1)
             return new ArrayList&lt;&gt;(nodes);
    
         // Setup Variables
         var list = new ArrayList&lt;&gt;(nodes);
         var depot = start == null ? 0 : list.indexOf(start);
         var manager = new RoutingIndexManager(list.size(), 1, depot);
         var routing = new RoutingModel(manager);
    
         // Define dummy weight function
         var transitCallbackIndex = routing.registerTransitCallback((fromIndex, toIndex) -&gt; 1L);
         routing.setArcCostEvaluatorOfAllVehicles(transitCallbackIndex);
    
         // Solve
         var parameters = main.defaultRoutingSearchParameters().toBuilder();
         parameters.setFirstSolutionStrategy(FirstSolutionStrategy.Value.PATH_CHEAPEST_ARC);
         var solution = routing.solveWithParameters(parameters.build()); // Problematic line
         return new ArrayList&lt;&gt;(); // Dummy return
     }

I also tryied making the method syncronized, using a lock and calling closeModel() after running the TSP, but no lucky.


  [1]: https://pastebin.com/1VJCsa1F

</details>


# 答案1
**得分**: 1

与 https://github.com/google/or-tools/issues/2091 相关。

请不要犹豫使用所有这些信息打开一个 GitHub 问题...

<details>
<summary>英文:</summary>

seems related to https://github.com/google/or-tools/issues/2091

Please, don&#39;t hesitate to open a github issue with all this information...

</details>



huangapple
  • 本文由 发表于 2020年7月22日 11:49:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/63026553.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定