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

ida examples segfault on OSX #14

Closed
acroy opened this issue Jun 2, 2014 · 19 comments
Closed

ida examples segfault on OSX #14

acroy opened this issue Jun 2, 2014 · 19 comments
Labels

Comments

@acroy
Copy link
Contributor

acroy commented Jun 2, 2014

Running the examples ida_Roberts_dns.jl or ida_Roberts_simplified.jl leads to a segmentation fault on my machine. Not sure if this is connected to #13? cc: @tkelman

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

Seems to work fine for me on Win32, Win64, RHEL64. Was this on a Mac? Clang problem?

@acroy
Copy link
Contributor Author

acroy commented Jun 3, 2014

Yep, this is on my Mac.

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

What version of OS X? Do the C examples work? I wouldn't be surprised if there's something in Sundials that Clang doesn't like, so this might be motivation to go the Homebrew binary route on Mac. There we should be able to specify we want gcc, if that turns out to be necessary.

@acroy
Copy link
Contributor Author

acroy commented Jun 3, 2014

I am on OSX 10.8.5. Can I build the examples separately? I can also try to build the library using gcc ...

@acroy
Copy link
Contributor Author

acroy commented Jun 3, 2014

I built the library and examples using MacPorts gcc (4.8.2) and it is still the same. The C example (idaRoberts_dns) works, but the Julia example segfaults ...

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

Can you track it down to which ccall causes trouble? I'm at a bit of a loss then, not sure what else would be different on Mac.

@acroy
Copy link
Contributor Author

acroy commented Jun 3, 2014

Seems to crash in

retval = Sundials.IDASolve(mem, tout, tret, yy, yp, Sundials.IDA_NORMAL)

but that could also be due to something going wrong in the initialization. It is also strange that this affects only IDA?

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

I meant inside Sundials.IDASolve, can you try to execute one line at a time to see where the problem occurs? Presumably it's in a ccall. I imagine IDA requires more inputs, has a more complicated API so the problem is in some code path that's specific to IDA rather than used by all of the solvers.

@acroy
Copy link
Contributor Author

acroy commented Jun 3, 2014

Sundials.IDASolve is effectively a ccall (see Sundials.jl#L79-L80 and ida.jl#82).

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

Oh, hah, my bad. Can you try to replicate the input data in C? If that doesn't work, maybe build a debug version of the IDA lib and run Julia through gdb/lldb? I think I made a debug version by running make CFLAGS=-g, couldn't find a better way through a configure flag.

@acroy
Copy link
Contributor Author

acroy commented Jun 17, 2014

I didn't have time to check the debug version. Just wanted to say that my colleague tried it on his Mac and it also fails for him ... So it seems to be Mac specific (I have changed the title of the issue).

@acroy acroy changed the title ida examples segfault ida examples segfault on OSX Jun 17, 2014
@tkelman
Copy link
Contributor

tkelman commented Jun 17, 2014

Was he also on 10.8?

@acroy
Copy link
Contributor Author

acroy commented Jun 17, 2014

I think he is on 10.7 but I will have to check that.

@kelvich
Copy link

kelvich commented Jul 13, 2014

Just came across the same trouble with today's julia-HEAD installation. Downgrading to 0.2.1 fixed that.

@jiahao
Copy link
Contributor

jiahao commented Aug 27, 2014

Can reproduce on 10.9.4 with julia-0.4-dev.

$ gdb --args julia-debug ida_Roberts_dns.jl
...
signal (11): Segmentation fault: 11
IDAInitialSetup at /Users/jiahao/.julia/v0.4/Sundials/deps/usr/lib/libsundials_idas.dylib (unknown line)
IDASolve at /Users/jiahao/.julia/v0.4/Sundials/deps/usr/lib/libsundials_ida.dylib (unknown line)
IDASolve at /Users/jiahao/.julia/v0.4/Sundials/src/Sundials.jl:87
jlcall_IDASolve;98687 at  (unknown line)
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1592
anonymous at no file:101
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_toplevel_eval_flex at /Users/jiahao/local/src/julia/src/toplevel.c:506
jl_parse_eval_all at /Users/jiahao/local/src/julia/src/toplevel.c:542
jl_load at /Users/jiahao/local/src/julia/src/toplevel.c:576
jl_load_ at /Users/jiahao/local/src/julia/src/toplevel.c:584
include at ./boot.jl:245
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1573
include_from_node1 at loading.jl:128
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1592
process_options at ./client.jl:285
_start at ./client.jl:354
_start at /Users/jiahao/local/src/julia/usr/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1573
jl_apply at /Users/jiahao/local/bin/julia-debug (unknown line)
true_main at /Users/jiahao/local/bin/julia-debug (unknown line)
julia_trampoline at /Users/jiahao/local/src/julia/src/init.c:1011
main at /Users/jiahao/local/bin/julia-debug (unknown line)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x000000010d2a0fa0 in IDAInitialSetup (IDA_mem=0x101bf6200) at idas.c:3868
3868        if (id->ops->nvwrmsnormmask == NULL) {
(gdb) bt
#0  0x000000010d2a0fa0 in IDAInitialSetup (IDA_mem=0x101bf6200) at idas.c:3868
#1  0x000000010d2d02e2 in IDASolve (ida_mem=0x101bf6200, tout=0.40000000000000002, tret=0x10e776470, yret=0x101781250, ypret=0x10179fff0, itask=1) at ida.c:1083
#2  0x000000010269c2be in ?? ()
#3  0x000000010269c1c7 in ?? ()
#4  0x0000000100022645 in jl_apply (f=0x10e81c820, args=0x7fff5fbfe410, nargs=6) at julia.h:982
#5  0x0000000100024898 in jl_trampoline (F=0x10e81c820, args=0x7fff5fbfe410, nargs=6) at builtins.c:791
#6  0x00000001000153e5 in jl_apply (f=0x10e81c820, args=0x7fff5fbfe410, nargs=6) at julia.h:982
#7  0x00000001000174fd in jl_apply_generic (F=0x10e0d7320, args=0x7fff5fbfe410, nargs=6) at gf.c:1592
#8  0x000000010269bc9a in ?? ()
#9  0x0000000100022645 in jl_apply (f=0x10e79d300, args=0x0, nargs=0) at julia.h:982
#10 0x0000000100024898 in jl_trampoline (F=0x10e79d300, args=0x0, nargs=0) at builtins.c:791
#11 0x00000001000f9ae5 in jl_apply (f=0x10e79d300, args=0x0, nargs=0) at julia.h:982
#12 0x00000001000f90a6 in jl_toplevel_eval_flex (e=0x10e7969a0, fast=1) at toplevel.c:506
#13 0x00000001000f9ca8 in jl_parse_eval_all (fname=0x10631f7f0 "/Users/jiahao/.julia/v0.4/Sundials/examples/ida_Roberts_dns.jl") at toplevel.c:542
#14 0x00000001000f9ea9 in jl_load (fname=0x10631f7f0 "/Users/jiahao/.julia/v0.4/Sundials/examples/ida_Roberts_dns.jl") at toplevel.c:576
#15 0x00000001000f9f2b in jl_load_ (str=0x10634af20) at toplevel.c:584
#16 0x0000000103262f40 in julia_include;80517 () at boot.jl:245
#17 0x00000001000153e5 in jl_apply (f=0x1062522e0, args=0x7fff5fbfea68, nargs=1) at julia.h:982
#18 0x00000001000173d1 in jl_apply_generic (F=0x1062521c0, args=0x7fff5fbfea68, nargs=1) at gf.c:1573
#19 0x000000010268479a in ?? ()
#20 0x0000000100022645 in jl_apply (f=0x1069c1ec0, args=0x7fff5fbfee90, nargs=1) at julia.h:982
#21 0x0000000100024898 in jl_trampoline (F=0x1069c1ec0, args=0x7fff5fbfee90, nargs=1) at builtins.c:791
#22 0x00000001000153e5 in jl_apply (f=0x1069c1ec0, args=0x7fff5fbfee90, nargs=1) at julia.h:982
#23 0x00000001000174fd in jl_apply_generic (F=0x1052117c0, args=0x7fff5fbfee90, nargs=1) at gf.c:1592
#24 0x0000000103461387 in julia_process_options;96160 () at client.jl:285
#25 0x000000010345bd95 in julia__start;96045 () at client.jl:354
#26 0x000000010345c6c9 in jlcall__start;96045 ()
#27 0x0000000100022645 in jl_apply (f=0x102bcb520, args=0x0, nargs=0) at julia.h:982
#28 0x0000000100024898 in jl_trampoline (F=0x102bcb520, args=0x0, nargs=0) at builtins.c:791
#29 0x00000001000153e5 in jl_apply (f=0x102bcb520, args=0x0, nargs=0) at julia.h:982
#30 0x00000001000173d1 in jl_apply_generic (F=0x102bcb460, args=0x0, nargs=0) at gf.c:1573
#31 0x0000000100002265 in jl_apply (f=0x102bcb460, args=0x0, nargs=0) at julia.h:982
#32 0x0000000100001ed4 in true_main (argc=1, argv=0x7fff5fbff588) at repl.c:328
#33 0x00000001000ec5ef in julia_trampoline (argc=1, argv=0x7fff5fbff588, pmain=0x100001ce0 <true_main>) at init.c:1011
#34 0x0000000100002406 in main (argc=1, argv=0x7fff5fbff588) at repl.c:379
Current language:  auto; currently minimal

@jiahao jiahao added the bug label Aug 27, 2014
@acroy
Copy link
Contributor Author

acroy commented Aug 27, 2014

Seems we found the reason in #25 and Tony has a patch in #30. As a quick
workaround you can change deps.jl file such that idas and cvodes libs are
checked after Ida and cvode respectively. Would be great if you could try
this.

On Wednesday, August 27, 2014, Jiahao Chen notifications@github.com wrote:

Can reproduce on 10.9.4 with julia-0.4-dev.

$ gdb --args julia-debug ida_Roberts_dns.jl
...
signal (11): Segmentation fault: 11
IDAInitialSetup at /Users/jiahao/.julia/v0.4/Sundials/deps/usr/lib/libsundials_idas.dylib (unknown line)
IDASolve at /Users/jiahao/.julia/v0.4/Sundials/deps/usr/lib/libsundials_ida.dylib (unknown line)
IDASolve at /Users/jiahao/.julia/v0.4/Sundials/src/Sundials.jl:87
jlcall_IDASolve;98687 at (unknown line)
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1592
anonymous at no file:101
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_toplevel_eval_flex at /Users/jiahao/local/src/julia/src/toplevel.c:506
jl_parse_eval_all at /Users/jiahao/local/src/julia/src/toplevel.c:542
jl_load at /Users/jiahao/local/src/julia/src/toplevel.c:576
jl_load_ at /Users/jiahao/local/src/julia/src/toplevel.c:584
include at ./boot.jl:245
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1573
include_from_node1 at loading.jl:128
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1592
process_options at ./client.jl:285
_start at ./client.jl:354
_start at /Users/jiahao/local/src/julia/usr/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_trampoline at /Users/jiahao/local/src/julia/src/builtins.c:791
jl_apply at /Users/jiahao/local/src/julia/src/./julia.h:982
jl_apply_generic at /Users/jiahao/local/src/julia/src/gf.c:1573
jl_apply at /Users/jiahao/local/bin/julia-debug (unknown line)
true_main at /Users/jiahao/local/bin/julia-debug (unknown line)
julia_trampoline at /Users/jiahao/local/src/julia/src/init.c:1011
main at /Users/jiahao/local/bin/julia-debug (unknown line)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x000000010d2a0fa0 in IDAInitialSetup (IDA_mem=0x101bf6200) at idas.c:3868
3868 if (id->ops->nvwrmsnormmask == NULL) {
(gdb) bt
#0 0x000000010d2a0fa0 in IDAInitialSetup (IDA_mem=0x101bf6200) at idas.c:3868
#1 0x000000010d2d02e2 in IDASolve (ida_mem=0x101bf6200, tout=0.40000000000000002, tret=0x10e776470, yret=0x101781250, ypret=0x10179fff0, itask=1) at ida.c:1083
#2 0x000000010269c2be in ?? ()
#3 0x000000010269c1c7 in ?? ()
#4 0x0000000100022645 in jl_apply (f=0x10e81c820, args=0x7fff5fbfe410, nargs=6) at julia.h:982
#5 0x0000000100024898 in jl_trampoline (F=0x10e81c820, args=0x7fff5fbfe410, nargs=6) at builtins.c:791
#6 0x00000001000153e5 in jl_apply (f=0x10e81c820, args=0x7fff5fbfe410, nargs=6) at julia.h:982
#7 0x00000001000174fd in jl_apply_generic (F=0x10e0d7320, args=0x7fff5fbfe410, nargs=6) at gf.c:1592
#8 0x000000010269bc9a in ?? ()
#9 0x0000000100022645 in jl_apply (f=0x10e79d300, args=0x0, nargs=0) at julia.h:982
#10 0x0000000100024898 in jl_trampoline (F=0x10e79d300, args=0x0, nargs=0) at builtins.c:791
#11 0x00000001000f9ae5 in jl_apply (f=0x10e79d300, args=0x0, nargs=0) at julia.h:982
#12 0x00000001000f90a6 in jl_toplevel_eval_flex (e=0x10e7969a0, fast=1) at toplevel.c:506
#13 0x00000001000f9ca8 in jl_parse_eval_all (fname=0x10631f7f0 "/Users/jiahao/.julia/v0.4/Sundials/examples/ida_Roberts_dns.jl") at toplevel.c:542
#14 0x00000001000f9ea9 in jl_load (fname=0x10631f7f0 "/Users/jiahao/.julia/v0.4/Sundials/examples/ida_Roberts_dns.jl") at toplevel.c:576
#15 0x00000001000f9f2b in jl_load_ (str=0x10634af20) at toplevel.c:584
#16 0x0000000103262f40 in julia_include;80517 () at boot.jl:245
#17 0x00000001000153e5 in jl_apply (f=0x1062522e0, args=0x7fff5fbfea68, nargs=1) at julia.h:982
#18 0x00000001000173d1 in jl_apply_generic (F=0x1062521c0, args=0x7fff5fbfea68, nargs=1) at gf.c:1573
#19 0x000000010268479a in ?? ()
#20 0x0000000100022645 in jl_apply (f=0x1069c1ec0, args=0x7fff5fbfee90, nargs=1) at julia.h:982
#21 0x0000000100024898 in jl_trampoline (F=0x1069c1ec0, args=0x7fff5fbfee90, nargs=1) at builtins.c:791
#22 0x00000001000153e5 in jl_apply (f=0x1069c1ec0, args=0x7fff5fbfee90, nargs=1) at julia.h:982
#23 0x00000001000174fd in jl_apply_generic (F=0x1052117c0, args=0x7fff5fbfee90, nargs=1) at gf.c:1592
#24 0x0000000103461387 in julia_process_options;96160 () at client.jl:285
#25 0x000000010345bd95 in julia__start;96045 () at client.jl:354
#26 0x000000010345c6c9 in jlcall__start;96045 ()
#27 0x0000000100022645 in jl_apply (f=0x102bcb520, args=0x0, nargs=0) at julia.h:982
#28 0x0000000100024898 in jl_trampoline (F=0x102bcb520, args=0x0, nargs=0) at builtins.c:791
#29 0x00000001000153e5 in jl_apply (f=0x102bcb520, args=0x0, nargs=0) at julia.h:982
#30 0x00000001000173d1 in jl_apply_generic (F=0x102bcb460, args=0x0, nargs=0) at gf.c:1573
#31 0x0000000100002265 in jl_apply (f=0x102bcb460, args=0x0, nargs=0) at julia.h:982
#32 0x0000000100001ed4 in true_main (argc=1, argv=0x7fff5fbff588) at repl.c:328
#33 0x00000001000ec5ef in julia_trampoline (argc=1, argv=0x7fff5fbff588, pmain=0x100001ce0 <true_main>) at init.c:1011
#34 0x0000000100002406 in main (argc=1, argv=0x7fff5fbff588) at repl.c:379
Current language: auto; currently minimal


Reply to this email directly or view it on GitHub
#14 (comment)
.

@kelvich
Copy link

kelvich commented Aug 28, 2014

Yes, changed deps.jl in way that you suggest and that worked for me, thanks!

@ViralBShah
Copy link
Contributor

Can this be closed?

@acroy
Copy link
Contributor Author

acroy commented Oct 9, 2014

Yes, should be fixed by #30.

On Thursday, October 9, 2014, Viral B. Shah notifications@github.com
wrote:

Can this be closed?


Reply to this email directly or view it on GitHub
#14 (comment)
.

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

No branches or pull requests

5 participants