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

Segfault on start #2908

Open
arieroos opened this issue May 7, 2019 · 9 comments
Open

Segfault on start #2908

arieroos opened this issue May 7, 2019 · 9 comments

Comments

@arieroos
Copy link

arieroos commented May 7, 2019

The game segfaults when I run it. Here's what I got from gdb:

Starting program: /usr/bin/python3 ./unknown-horizons
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff3713830 in ?? ()
@arieroos
Copy link
Author

OK, since I didn't get a reply on this issue yet, I decided to dig into the code myself.

I ran the project through my vscodium setup with the python fault finder enabled. The crash happens on line 109 of run_uh.py import horizons.main

Here's the output from the fault finder:

Fatal Python error: Segmentation fault

Thread 0x00007f2a2affd700 (most recent call first):
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevd.py", line 196 in _on_run
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 162 in run
  File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
  File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap

Thread 0x00007f2a2b7fe700 (most recent call first):
  File "/usr/lib/python3.5/threading.py", line 297 in wait
  File "/usr/lib/python3.5/threading.py", line 549 in wait
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevd.py", line 168 in _on_run
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 162 in run
  File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
  File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap

Thread 0x00007f2a2bfff700 (most recent call first):
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/wrapper.py", line 286 in recv
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 251 in _read_line
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 263 in _on_run
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 162 in run
  File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
  File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap

Thread 0x00007f2a38b15700 (most recent call first):
  File "/usr/lib/python3.5/threading.py", line 297 in wait
  File "/usr/lib/python3.5/queue.py", line 173 in get
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 363 in _on_run
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 162 in run
  File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
  File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap

Thread 0x00007f2a39356700 (most recent call first):
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/ipcjson.py", line 113 in _buffered_read_line_as_ascii
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/ipcjson.py", line 154 in _wait_for_message
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/ipcjson.py", line 272 in process_one_message
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/ipcjson.py", line 258 in process_messages
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/wrapper.py", line 722 in process_messages
  File "/usr/lib/python3.5/threading.py", line 862 in run
  File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
  File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap

Thread 0x00007f2a39b57700 (most recent call first):
  File "/usr/lib/python3.5/threading.py", line 297 in wait
  File "/usr/lib/python3.5/threading.py", line 549 in wait
  File "/home/arie/.vscode-oss/extensions/ms-python.python-2019.4.12954/pythonFiles/lib/python/ptvsd/futures.py", line 122 in run_forever
  File "/usr/lib/python3.5/threading.py", line 862 in run
  File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
  File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap

Current thread 0x00007f2a3db95700 (most recent call first):
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 34 in <module>
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 665 in exec_module
  File "<frozen importlib._bootstrap>", line 673 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23 in <module>
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 665 in exec_module
  File "<frozen importlib._bootstrap>", line 673 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23 in <module>
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 665 in exec_module
  File "<frozen importlib._bootstrap>", line 673 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30 in <module>
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 665 in exec_module
  File "<frozen importlib._bootstrap>", line 673 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5 in <module>
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 665 in exec_module
  File "<frozen importlib._bootstrap>", line 673 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 944 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63 in apport_excepthook
Segmentation fault (core dumped)

Any ideas?

@arieroos
Copy link
Author

So I figured out how to do a backtrace in gdb. Here's the interesting part of the output:

#1  0x00007ffff486840c in ReadConfigFile(Configuration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool const&, unsigned int const&) ()
   from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
#2  0x00007ffff4867d97 in ReadConfigDir(Configuration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool const&, unsigned int const&) ()
   from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
#3  0x00007ffff48d29aa in pkgInitConfig(Configuration&) () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
#4  0x00007ffff4b5cc48 in ?? () from /usr/lib/python3/dist-packages/apt_pkg.cpython-35m-x86_64-linux-gnu.so
#5  0x00000000004ea10f in PyCFunction_Call ()

Any ideas on what I should be looking for?

@jmdejong
Copy link
Contributor

How did you install unknown horizons? And how did you install fife and fifechan?

@arieroos
Copy link
Author

I built fife and fifechan from the source according to the instructions in the uh wiki. I installed uh by running setup.py

@kyrios123
Copy link

I get the same problem

@LinuxDonald
Copy link
Member

Guys what distro are you using? And fife/fifechan and uh lastest git version? Or last release version?

@kyrios123
Copy link

I use Solus it's a x86_64 distro with kernel 5.1.14
Python 3.6.9
fifengine 0.4.2 / fifechan 0.1.5, both built from the latest tarball.

@TimSoethout
Copy link

TimSoethout commented Oct 16, 2019

I have the same problem on OSX. Python 3.7.4. unknown-horizons on tag 2019.1 using SWIG 4.0.
After a lot of pain building fifechan and fifengine from master.
I had to remove some build options in fifengine/CMakeLists.txt for it to build. That might influence this?

-  set(CMAKE_SWIG_FLAGS -fastdispatch -dirvtable -noproxydel -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone -keyword -w511 -w473 -w404 -w314)
+  set(CMAKE_SWIG_FLAGS -fastdispatch -dirvtable -fastproxy -keyword -w511 -w473 -w404 -w314)

python -vvv ./run_uh.py's output ends with

import 'optparse' # <_frozen_importlib_external.SourceFileLoader object at 0x106f85410>
import 'horizons.util.cmdlineoptions' # <_frozen_importlib_external.SourceFileLoader object at 0x106d61a10>
# trying /Users/tim/Downloads/unknown-horizons/horizons/util/migratepaths.cpython-37m-darwin.so
# trying /Users/tim/Downloads/unknown-horizons/horizons/util/migratepaths.abi3.so
# trying /Users/tim/Downloads/unknown-horizons/horizons/util/migratepaths.so
# trying /Users/tim/Downloads/unknown-horizons/horizons/util/migratepaths.py
# code object from /Users/tim/Downloads/unknown-horizons/horizons/util/migratepaths.py
# created '/Users/tim/Downloads/unknown-horizons/horizons/util/__pycache__/migratepaths.cpython-37.pyc'
# wrote '/Users/tim/Downloads/unknown-horizons/horizons/util/__pycache__/migratepaths.cpython-37.pyc'
import 'horizons.util.migratepaths' # <_frozen_importlib_external.SourceFileLoader object at 0x106f85890>
fish: Job 3, 'python -vvv ./run_uh.py' terminated by signal SIGSEGV (Address boundary error)

Thread dump:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0:
--> 
    __TEXT                 000000010cebf000-000000010cec1000 [    8K] r-x/rwx SM=COW  /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                           	000000000000000000 0 + 0
1   _fife.so                      	0x000000010ecd98bc FIFE::RenderBackendOpenGL::prepareForOverlays() + 28
2   _fife.so                      	0x000000010ecd9099 FIFE::RenderBackendOpenGL::setScreenMode(FIFE::ScreenMode const&) + 1481
3   _fife.so                      	0x000000010ecd8a29 FIFE::RenderBackendOpenGL::createMainScreen(FIFE::ScreenMode const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 25
4   _fife.so                      	0x000000010ec3d3e5 FIFE::Engine::init() + 4805
5   _fife.so                      	0x000000010e37b30f _wrap_Engine_init(_object*, _object*) + 63
6   org.python.python             	0x000000010cedcabd _PyMethodDef_RawFastCallKeywords + 622
7   org.python.python             	0x000000010cedbf98 _PyCFunction_FastCallKeywords + 44
8   org.python.python             	0x000000010cf7054b call_function + 729
9   org.python.python             	0x000000010cf68a83 _PyEval_EvalFrameDefault + 5156
10  org.python.python             	0x000000010cf70d36 _PyEval_EvalCodeWithName + 1683
11  org.python.python             	0x000000010cedbf5d _PyFunction_FastCallKeywords + 225
12  org.python.python             	0x000000010cf70552 call_function + 736
13  org.python.python             	0x000000010cf68a6a _PyEval_EvalFrameDefault + 5131
14  org.python.python             	0x000000010cedc377 function_code_fastcall + 116
15  org.python.python             	0x000000010cf70552 call_function + 736
16  org.python.python             	0x000000010cf68a83 _PyEval_EvalFrameDefault + 5156
17  org.python.python             	0x000000010cedc377 function_code_fastcall + 116
18  org.python.python             	0x000000010cf70552 call_function + 736
19  org.python.python             	0x000000010cf68b29 _PyEval_EvalFrameDefault + 5322
20  org.python.python             	0x000000010cf70d36 _PyEval_EvalCodeWithName + 1683
21  org.python.python             	0x000000010cf675d7 PyEval_EvalCode + 42
22  org.python.python             	0x000000010cf960e7 run_mod + 54
23  org.python.python             	0x000000010cf95117 PyRun_FileExFlags + 160
24  org.python.python             	0x000000010cf947e0 PyRun_SimpleFileExFlags + 277
25  org.python.python             	0x000000010cfac8ab pymain_main + 4955
26  org.python.python             	0x000000010cfad18b _Py_UnixMain + 75
27  libdyld.dylib                 	0x00007fff97f49235 start + 1

Thread 1:
0   libsystem_pthread.dylib       	0x00007fff98162070 start_wqthread + 0
1   ???                           	0x000070000cd34b30 0 + 123145517484848

Thread 2:
0   libsystem_pthread.dylib       	0x00007fff98162070 start_wqthread + 0
1   ???                           	0x007865646e496d65 0 + 33888479226719589

Thread 3:
0   libsystem_pthread.dylib       	0x00007fff98162070 start_wqthread + 0

Thread 4:
0   libsystem_kernel.dylib        	0x00007fff98077eb6 __select + 10
1   Tcl                           	0x0000000110e36987 NotifierThreadProc + 476
2   libsystem_pthread.dylib       	0x00007fff9816293b _pthread_body + 180
3   libsystem_pthread.dylib       	0x00007fff98162887 _pthread_start + 286
4   libsystem_pthread.dylib       	0x00007fff9816208d thread_start + 13

Thread 5:
0   libsystem_pthread.dylib       	0x00007fff98162070 start_wqthread + 0

Thread 6:
0   libsystem_kernel.dylib        	0x00007fff9807844e __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff98162621 _pthread_wqthread + 1426
2   libsystem_pthread.dylib       	0x00007fff9816207d start_wqthread + 13

Thread 7:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	0x00007fff9807034a mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff9806f797 mach_msg + 55
2   com.apple.CoreFoundation      	0x00007fff82744b44 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation      	0x00007fff82743fd1 __CFRunLoopRun + 1361
4   com.apple.CoreFoundation      	0x00007fff82743824 CFRunLoopRunSpecific + 420
5   com.apple.AppKit              	0x00007fff80385f02 _NSEventThread + 205
6   libsystem_pthread.dylib       	0x00007fff9816293b _pthread_body + 180
7   libsystem_pthread.dylib       	0x00007fff98162887 _pthread_start + 286
8   libsystem_pthread.dylib       	0x00007fff9816208d thread_start + 13

Thread 8:: SDLTimer
0   libsystem_kernel.dylib        	0x00007fff98077bf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib       	0x00007fff981637fa _pthread_cond_wait + 712
2   libSDL2-2.0.0.dylib           	0x000000010f3f8210 SDL_CondWaitTimeout_REAL + 144
3   libSDL2-2.0.0.dylib           	0x000000010f3f7e58 SDL_SemWaitTimeout_REAL + 75
4   libSDL2-2.0.0.dylib           	0x000000010f39589e SDL_TimerThread + 388
5   libSDL2-2.0.0.dylib           	0x000000010f395309 SDL_RunThread + 60
6   libSDL2-2.0.0.dylib           	0x000000010f3f7bc3 RunThread + 9
7   libsystem_pthread.dylib       	0x00007fff9816293b _pthread_body + 180
8   libsystem_pthread.dylib       	0x00007fff98162887 _pthread_start + 286
9   libsystem_pthread.dylib       	0x00007fff9816208d thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007f7f8df6ed20  rcx: 0x00007f7f8e9eae00  rdx: 0x00007fff87707fa6
  rdi: 0x00000000000084c1  rsi: 0x0000000000008074  rbp: 0x00007fff52d3f580  rsp: 0x00007fff52d3f558
   r8: 0x0000000000000303   r9: 0x00007f7f9007ce60  r10: 0x0000000000000001  r11: 0x0000000000000003
  r12: 0x00007fff52d3f5a8  r13: 0x0000000000000000  r14: 0x00007f7f902f85b0  r15: 0x000000010f605618
  rip: 0x0000000000000000  rfl: 0x0000000000010246  cr2: 0x0000000000000000
  
Logical CPU:     1
Error Code:      0x00000014
Trap Number:     14

Is FIFE::RenderBackendOpenGL::prepareForOverlays() + 28 the culprit?

@gorgobacka
Copy link

gorgobacka commented Dec 6, 2019

I built fife and fifechan from the source according to the instructions in the uh wiki. I installed uh by running setup.py

I did the same and also get a Segmentation fault.

Edit: Using explicitly the versions fifechan 0.1.5 and fifengine 0.4.2 solved the problem.

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

6 participants