Closed twadleigh closed 7 years ago
Caused on call to delete
during a GC event. Still not sure exactly why. Here is some of the stack dump:
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x18000d360 -- matrix::detail::noninlined::mx_array_api::mxIsContainer at C:\Program Files\MATLAB\R2016b\bin\win64\libmx.dll (unknown line)
while loading no file, in expression starting on line 0
matrix::detail::noninlined::mx_array_api::mxIsContainer at C:\Program Files\MATLAB\R2016b\bin\win64\libmx.dll (unknown line)
matrix::detail::noninlined::mx_array_api::mxHasCycleDetectionContents at C:\Program Files\MATLAB\R2016b\bin\win64\libmx.dll (unknown line)
delete at c:\tw\mexjulia\jl\mxarray.jl:28
unknown function (ip: 0000000025F2158A)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:189
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1942
jl_apply at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia.h:1392
run_finalizer at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gc.c:108
jl_gc_run_finalizers_in_list at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gc.c:190
run_finalizers at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gc.c:211
jl_gc_collect at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gc.c:1872
jl_gc_pool_alloc at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gc.c:828
jl_gc_alloc_ at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:148
jl_gc_alloc at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gc.c:1881
_new_array_ at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\array.c:108
_new_array at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\array.c:149
jl_alloc_array_2d at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\array.c:353
Type at .\boot.jl:321
unknown function (ip: 0000000025F36CC0)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:189
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1942
jl_apply_2va at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\builtins.c:430
zeros at .\array.jl:170
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:189
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1942
finite_difference_jacobian at C:\Users\hw9980\.julia\v0.5\Calculus\src\finite_difference.jl:201 [inlined]
g at C:\Users\hw9980\.julia\v0.5\Calculus\src\derivative.jl:32 [inlined]
#levenberg_marquardt#65 at C:\Users\hw9980\.julia\v0.5\Optim\src\levenberg_marquardt.jl:73
unknown function (ip: 0000000025F243C3)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:189
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1942
lmdif at c:\tw\mexjulia\examples\lmdif.jl:6
unknown function (ip: 0000000025F2183A)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:189
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1942
jl_apply at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia.h:1392
jl_f__apply at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\builtins.c:547
jl_call at c:\tw\mexjulia\jl\Mex.jl:85
unknown function (ip: 0000000025F1E236)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:189
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1942
jl_mex at c:\tw\mexjulia\jl\Mex.jl:62
unknown function (ip: 0000000025F168DA)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:189
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1942
jl_apply at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia.h:1392
jl_call2 at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\jlapi.c:175
mexFunction at c:\tw\mexjulia\mexjulia.cpp:60
I can also generate the crash by evaling gc()
after a run of lmdif_test
.
The issue turns out to be that dynamically created mxArrays
are destroyed by MATLAB after the return of the MEX function. Julia garbage collection will try to call mxDestroyArray
on any MxArray
that "owns" its data, generating an access violation if a gc trys to delete an already deleted array.
The fix seems to be making sure that gc()
is called before returning from a call to mexjulia
.
On Windows, at least. No idea yet what causes it.