1. Segmentation fault on exit on Linux
- Posted by ghaberek (admin) Oct 27, 2015
- 1571 views
After adding the custom Euphoria lexer to the The Euphoria Editor, I get a segfault when exiting the application. The "signal" part is always different and there is no trailing right parenthesis, which seems really strange to me. I feel this may have to do with the Scintilla library dynamically loading my custom LexerEuphoria.so library, but I'm not confident in that guess. It may be a bug in the interpreter. It does not occur when I translate to C. I am using the latest 4.1.0 64-bit available on the Downloads page. I went so far as to compile eui with debugging and run that through gdb, but I don't get a very useful backtrace after the application exits.
Application output:
~/Projects/editor/bin$ eui ../src/editor.ex Fatal run-time error: A machine-level exception occurred during execution of this statement (signal 156
GDB backtrace:
(gdb) backtrace #0 0x00007ffff10111d0 in ?? () #1 0x00000000011dad70 in ?? () #2 0x00007ffff0e6114b in ?? () #3 0x00000000011dad70 in ?? () #4 0x00007ffff7ffd948 in _rtld_global () from /lib64/ld-linux-x86-64.so.2 #5 0x0000000000000001 in ?? () #6 0x0000000000ff2d80 in ?? () #7 0x00000000011dad70 in ?? () #8 0x00007ffff0e612e7 in ?? () #9 0x00000000017e3f00 in ?? () #10 0x00007ffff125d758 in ?? () #11 0x00007ffff76b7f20 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #12 0x00007ffff0e61346 in ?? () #13 0x0000000000000001 in ?? () #14 0x0000000000000000 in ?? ()
I just created directions for Running from Source in order to help with testing this from the latest source. I wrote the directions from memory, so if they are incorrect, let me know and I will fix them. Hopefully somebody can help with this because I am out of my element on debugging with the interpreter.
-Greg
2. Re: Segmentation fault on exit on Linux
- Posted by PeteE Oct 28, 2015
- 1477 views
Hi Greg, I followed your instructions, and the editor works. The Euphoria lexer seems to be ok, since functions can be folded. But when I close the editor, I don't get a segfault. Ubuntu 15.04, 64-bit.
Edit: the only difference is that I have to run it from the src directory: LD_LIBRARY_PATH=../bin eui editor.ex
3. Re: Segmentation fault on exit on Linux
- Posted by ghaberek (admin) Oct 28, 2015
- 1502 views
Hi Greg, I followed your instructions, and the editor works. The Euphoria lexer seems to be ok, since functions can be folded. But when I close the editor, I don't get a segfault. Ubuntu 15.04, 64-bit.
Interesting. I just ran a test on test VM running Ubuntu 14.04 64-bit and got the segfault I expected. I will try a few other distros see what I get.
Maybe it's actually a libc problem since that's what my backtrace was pointing to. That would also explain why I don't see a machine-level crash on Windows.
Edit: the only difference is that I have to run it from the src directory: LD_LIBRARY_PATH=../bin eui editor.ex
Yes, you have to set LD_LIBRARY_PATH to use local shared libraries. But that's what editor.cmd and editor.sh do for you automatically. I updated the Running from Source document to better reflect this.
-Greg
4. Re: Segmentation fault on exit on Linux
- Posted by ghaberek (admin) Oct 28, 2015
- 1468 views
Edit: the only difference is that I have to run it from the src directory: LD_LIBRARY_PATH=../bin eui editor.ex
Yes, you have to set LD_LIBRARY_PATH to use local shared libraries. But that's what editor.cmd and editor.sh do for you automatically. I updated the Running from Source document to better reflect this.
As an aside, the permanent fix for this problem is to include -Wl,--rpath=./ in the LDFLAGS option when building the interpreter.
You can add this parameter when translating an application to prevent having to use LD_LIBRARY_PATH, e.g.
I will be doing this when I start providing binary releases and installers for the editor.
-Greg
5. Re: Segmentation fault on exit on Linux
- Posted by jimcbrown (admin) Oct 29, 2015
- 1426 views
Does the issue occur on a 32bit interpreter too?
6. Re: Segmentation fault on exit on Linux
- Posted by ghaberek (admin) Oct 29, 2015
- 1419 views
Does the issue occur on a 32bit interpreter too?
Yes. I just threw together a Lubuntu 14.04 32-bit machine and got almost the same result.
The only difference is that the run-time error includes the correct signal and the right parenthesis.
Fatal run-time error: A machine-level exception occurred during execution of this statement (signal 11)
I pulled Beta for Testing: Euphoria 4.1.0 Beta 2 from the Downloads page.
-Greg