addDimensionWithVehicleCapacity hits Java memory access error EXCEPTION_ACCESS_VIOLATION

155 views
Skip to first unread message

smile-on

unread,
Nov 28, 2016, 3:02:18 PM11/28/16
to or-tools-discuss
Any Java developer expects library to pin java objects it uses. I was able to use  routing.addDimension() successfully but moving to routing.addDimensionWithVehicleCapacity() hit EXCEPTION_ACCESS_VIOLATION which to me sounds like JVM freed memory that was used in JNI call. I don't know details of Google protobufer and Swig techicalities library is using to bridge Java with C++ but something strange happens at addDimensionWithVehicleCapacity call. I also noticed some memory object in C# library got pinned manually before calls.

This Java fragment works fine
routing.addDimension(formulation.volumeCallback, slack_max, aVehicle.capacityVolume, fix_start_cumul_to_zero, "volume");
wher aVehicle.capacityVolume is a simple Java int.

That fails with 
EXCEPTION_ACCESS_VIOLATION
routing.addDimensionWithVehicleCapacity(formulation.volumeCallback, slack_max, formulation.volumeCaps, fix_start_cumul_to_zero, "volume");
where 
formulation.volumeCaps is regular Java array long[#_of_vechicls]

# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fee1c1aed9, pid=3572, tid=0x000000000000147c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_102-b14) (build 1.8.0_102-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [jniortools.dll+0x7aed9]
#
Register to memory mapping:

RAX=0x000000000000000a is an unknown value
RBX={method} {0x0000000019860300} 'RoutingModel_addDimensionWithVehicleCapacity' '(JLcom/google/ortools/constraintsolver/RoutingModel;JLcom/google/ortools/constraintsolver/NodeEvaluator2;J[JZLjava/lang/String;)Z' in 'com/google/ortools/constraintsolver/operations_research_constraint_solverJNI'


I can't figure out what do I do wrong in terms of or-tools API.
Do you have any Java tests / Java examples where you used addDimensionWithVehicleCapacity() ?

smile-on

unread,
Nov 28, 2016, 3:18:44 PM11/28/16
to or-tools-discuss
 I found official reference to AddDimensionWithVehicleCapacity on page 400 of "The User Manual on API" :)


Bad part, that text does not match Java declaration I see in the library.
I see long[] instead of VehicleEvaluator* vehicle_capacity in the declaration
//fails

smile-on

unread,
Nov 30, 2016, 2:53:31 PM11/30/16
to or-tools-discuss
Very trivial example of multi vehicle CVRP has been created SimpleRoutingMultiVehicles.java.
It demonstraits EXCEPTION_ACCESS_VIOLATION error. Unfortunately I can't see what I do wrong and need someone to point on the problem.

Ken Alton

unread,
Dec 9, 2016, 5:17:04 AM12/9/16
to or-tools-discuss
This issue should be resolved with https://github.com/google/or-tools/pull/287. Please let me know how it goes.

smile-on

unread,
Dec 13, 2016, 9:42:54 AM12/13/16
to or-tools-discuss
I am using compiled distributive of or-tools (or-tools_VisualStudio2015-64bit_v5.0.3919.zip). Which release is the change goint to be included in?

Driss Lahlou

unread,
Dec 13, 2016, 9:51:33 AM12/13/16
to or-tools...@googlegroups.com
The next one, mostly this month.

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

driss
Reply all
Reply to author
Forward
0 new messages