-
Notifications
You must be signed in to change notification settings - Fork 48
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
Linux installer's Forge causes MATLAB to crash #231
Comments
@villekf Did you check if right set of libraries are being used when arrayfire is being used from ArrayFire ? You can run the program with |
With
after which the crash occurs. libforge.so can only be found from the AF install lib64-folder. |
It should have continued without a crash - that's the expected behavior, even if it didn't load forge library. Can you please the entire log of all trace output. |
If the Forge files are in the library folder, that is all the output there is (MATLAB segfaults). If I remove them, the output becomes this on OpenCL (and everything works without crashes):
|
Which backend are you using ? Based on your output, the program does progress after trying to load forge and it fails. I am guessing somehow the forge lib is corrupt because we do handle the scenario when forge loading fails, in all backends. Can you try reproducing this using regular C++ example - try any C++ graphics example that get's shipped with out installer ? If yes, then the problem is within the code. If not, then it must be something related to environment that mex program starts with I would think. |
I'm using OpenCL, but the same thing happens for both CPU and CUDA as well. Running the conway_opencl example produces the following when using the installer libraries:
CUDA:
On the other hand, building from source (no crashes in MATLAB, this time the current master) produces the following with conway_opencl:
Non-graphics related examples work fine in both cases, e.g. helloworld completes fine (though the same GLX error shows up in OpenCL versions). The crashes seem to occur only in MATLAB as well as in GNU Octave (both mex- and oct-files). |
@villekf Is it possible for you to reach out to me on https://join.slack.com/t/arrayfire-org/shared_invite/MjI4MjIzMDMzMTczLTE1MDI5ODg4NzYtN2QwNGE3ODA5OQ we can continue discussion over there. I have some questions, a quick back and forth may resolve the problem quickly which is much easier on slack. |
Self reminder to @9prady9 Need to try this setup with Octave. |
@villekf I was able to reproduce this problem. As you have experienced, the problem seems to stem only if forge.so from installer binary is being used. I shall update here once again as soon as I found a fix for the same. Thank you for reporting it! Note that you can work around the issue by doing |
Wow, finally found the problem. There is global constant of type The root cause is the following: somehow an allocation request is being made during the creation of this regex constant with a size is very huge (seems like garbage value). Here is the stack trace #0 0x00007ffff5727012 in __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*))
(obj=0x7fffdc6b5eb0, tinfo=0x7ffff5851ee0 <typeinfo for std::bad_alloc>, dest=0x7ffff57252e0 <std::bad_alloc::~bad_alloc()>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
arrayfire/arrayfire#1 0x00007ffff571a438 in operator new(unsigned long) (sz=281474137743328) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/new_op.cc:54
arrayfire/arrayfire#2 0x00007ffff576b9aa in __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) (__n=<optimized out>, this=<optimized out>)
at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/new_allocator.h:115
arrayfire/arrayfire#3 std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (__capacity=281474137743303,
__capacity@entry=140737312585472, __old_capacity=<optimized out>, __alloc=...) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:1060
arrayfire/arrayfire#4 0x00007ffff576bb40 in std::string::_M_mutate(unsigned long, unsigned long, unsigned long) (this=0x7fffe6ff2e88, __pos=__pos@entry=0, __len1=__len1@entry=0, __len2=__len2@entry=0)
at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:931
arrayfire/arrayfire#5 0x00007ffff576bd5c in std::string::_M_leak_hard() (this=0x7fffe6ff2e88) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:914
arrayfire/arrayfire#6 0x00007fffe492816a in std::__detail::_Compiler<std::regex_traits<char> >::_M_atom() () at /home/pradeep/arrayfire/lib64/libforge.so
arrayfire/arrayfire#7 0x00007fffe4928ae8 in std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative() () at /home/pradeep/arrayfire/lib64/libforge.so
arrayfire/arrayfire#8 0x00007fffe4928cf9 in std::__detail::_Compiler<std::regex_traits<char> >::_M_disjunction() () at /home/pradeep/arrayfire/lib64/libforge.so
arrayfire/arrayfire#9 0x00007fffe492942b in std::__detail::_Compiler<std::regex_traits<char> >::_Compiler(char const*, char const*, std::locale const&, std::regex_constants::syntax_option_type) ()
at /home/pradeep/arrayfire/lib64/libforge.so
arrayfire/arrayfire#10 0x00007fffe4929907 in std::enable_if<std::__detail::__is_contiguous_normal_iter<char const*>::value, std::shared_ptr<std::__detail::_NFA<std::regex_traits<char> > const> >::type std::__detail::__compile_nfa<char const*, std::regex_traits<char> >(char const*, char const*, std::regex_traits<char>::locale_type const&, std::regex_constants::syntax_option_type) ()
at /home/pradeep/arrayfire/lib64/libforge.so
arrayfire/arrayfire#11 0x00007fffe490daff in _GLOBAL__sub_I_chart_impl.cpp () at /home/pradeep/arrayfire/lib64/libforge.so
arrayfire/arrayfire#12 0x00007ffff7fdbe8e in call_init.part () at /lib64/ld-linux-x86-64.so.2
arrayfire/arrayfire#13 0x00007ffff7fdbf78 in _dl_init () at /lib64/ld-linux-x86-64.so.2
arrayfire/arrayfire#14 0x00007ffff55d6b95 in _dl_catch_exception () at /usr/lib/libc.so.6
arrayfire/arrayfire#15 0x00007ffff7fe030a in dl_open_worker () at /lib64/ld-linux-x86-64.so.2
arrayfire/arrayfire#16 0x00007ffff55d6b38 in _dl_catch_exception () at /usr/lib/libc.so.6
arrayfire/arrayfire#17 0x00007ffff7fdfade in _dl_open () at /lib64/ld-linux-x86-64.so.2
arrayfire/arrayfire#18 0x00007ffff1fa934c in () at /usr/lib/libdl.so.2
arrayfire/arrayfire#19 0x00007ffff55d6b38 in _dl_catch_exception () at /usr/lib/libc.so.6
arrayfire/arrayfire#20 0x00007ffff55d6c03 in _dl_catch_error () at /usr/lib/libc.so.6
arrayfire/arrayfire#21 0x00007ffff1fa9b89 in () at /usr/lib/libdl.so.2
arrayfire/arrayfire#22 0x00007ffff1fa93d8 in dlopen () at /usr/lib/libdl.so.2
arrayfire/arrayfire#23 0x00007fff757e345a in common::loadLibrary(char const*) (library_name=<optimized out>) at ../src/backend/common/module_loading_unix.cpp:25 I am trying to explore some leads w.r.t this and figure out what is the best way to resolve this. |
Note that, none of this is an issue when the same set of shared libraries from the installer are used directly i.e. not from a octave mex function. |
for any future users https://stackoverflow.com/questions/51382355/stdregex-and-dual-abi |
Found the root cause of this finally - https://bugzilla.redhat.com/show_bug.cgi?id=1546704 Note: Forge so file from ArrayFire Installer is built on CentOS using devtoolset-7. |
Any update on this? |
The Forge included in the official Linux installer is currently causing MATLAB to crash (segfault) when an ArrayFire mex-code is run (the below example causes this).
On Windows, using the installer and MATLAB has no issues. Furthermore, building AF from source with Forge ON (or OFF) also works. If these built Forge libraries are replaced with the ones from the installer, the crashes start to occur. Removing the Forge libraries altogether removes the crashes.
This occurs both with AF 3.7.1 and 3.6.2 (where the no-gl installer works). GCC/G++ used was 7.5.0 with Ubuntu 18.04.
The text was updated successfully, but these errors were encountered: