Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unstability #4

Open
maartenvd opened this issue Apr 2, 2021 · 3 comments
Open

unstability #4

maartenvd opened this issue Apr 2, 2021 · 3 comments

Comments

@maartenvd
Copy link

I'm trying to write bindings to optimkit.jl; and for the most part they work. In essence I need matlab to call a julia function, which then calls small matlab functions (retraction, inner product, ...). However if I use it often enough, it sometimes segfaults. Because the failure is sporadic and at random, I would suspect the garbage collector sometimes cleaning things up that are still referenced?

I have attached some self-contained test code. setup_julia; test_mex; should work, but "for i =1:100; test_mex; end;" should crash somewhere down the line. I will also try to debug this further; now at least I get a stack trace.
testmex.zip

stacktrace

Stack Trace (from fault):
[  0] 0x00007f4ca7dbc864                               bin/glnxa64/libmx.so+01591396 _ZN6matrix6detail10noninlined12mx_array_api13mxIsContainerEPK11mxArray_tag+00000020
[  1] 0x00007f4ca7ca9d52                               bin/glnxa64/libmx.so+00466258
[  2] 0x00007f4ca7ca983f                               bin/glnxa64/libmx.so+00464959
[  3] 0x00007f4c281fceff                                   <unknown-module>+00000000
[  4] 0x00007f4c3b5b3c6f          /home/maarten/julia/usr/lib/libjulia.so.1+01064047
[  5] 0x00007f4c3b5b4800          /home/maarten/julia/usr/lib/libjulia.so.1+01067008
[  6] 0x00007f4c3b5bcd68          /home/maarten/julia/usr/lib/libjulia.so.1+01101160 jl_gc_collect+00000904
[  7] 0x00007f4c3b5bcf2b          /home/maarten/julia/usr/lib/libjulia.so.1+01101611 jl_gc_pool_alloc+00000043
[  8] 0x00007f4c282067da                                   <unknown-module>+00000000
[  9] 0x00007f4c281f98df                                   <unknown-module>+00000000
[ 10] 0x00007f4c281fa89c                                   <unknown-module>+00000000
[ 11] 0x00007f4c2820d1b1                                   <unknown-module>+00000000
[ 12] 0x00007f4c28217e93                                   <unknown-module>+00000000
[ 13] 0x00007f4c2821aaec                                   <unknown-module>+00000000
[ 14] 0x00007f4c2821c400                                   <unknown-module>+00000000
[ 15] 0x00007f4c3b569823          /home/maarten/julia/usr/lib/libjulia.so.1+00759843 jl_apply_generic+00001811
....

Also, building mex.jl fails on 1.6, because it cannot find jl_options.

@jebej
Copy link
Owner

jebej commented Apr 2, 2021

Let's address the compilation failure on 1.6 at #6

@jebej
Copy link
Owner

jebej commented Apr 2, 2021

Do you notice if the crashes happen after an error is thrown on the julia side?

@maartenvd
Copy link
Author

Usually when I get errors on the julia side, I do get the stack trace in matlab, but further mex calls appear to lead to crashes. Not so here - I don't get a stack trace and the problem I give optimkit is extremely easy (3 x 3 hermitian matrix; smallest eigenvalue), an analogue implementation in julia does not error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants