eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.55k stars 1.43k forks source link

sumo-gui segmentation fault in Mac OS Catalina #6242

Closed BrunoSalerno closed 4 years ago

BrunoSalerno commented 5 years ago

With MacOS Catalina and XQuartz 2.7.11, if I try to run sumo-gui (with or without the -c argument) I get:

 segmentation fault  sumo-gui

I installed sumo (version 1.3.1) using homebrew.

JVillella commented 5 years ago

We're presently running a competition on CodaLab with users using sumo as a backend. We have around five teams experiencing this problem. Here's one of the threads we are using to debug the issue: https://competitions.codalab.org/forums/18353/3060/.

and here's a relevant console output,

process: sumo-gui [4935]
Path: /usr/local/Cellar/sumo/1.3.1/bin/sumo-gui
Identifier: sumo-gui
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [3183]
Responsible: iTerm2 [3006]
User ID: 501

Date/Time: 2019-11-06 23:21:26.537 +0000
OS Version: Mac OS X 10.15.1 (19B88)
Report Version: 12
Bridge OS Version: 4.1 (17P1081)

Time Awake Since Boot: 4600 seconds

System Integrity Protection: enabled

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

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Exception Note: EXC_CORPSE_NOTIFY

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

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libdyld.dylib 0x00007fff6ea2f386 stack_not_16_byte_aligned_error + 0
1 ??? 0x00007ffee658d180 0 + 140732763001216
2 sumo-gui 0x000000010973d38e GUIIconSubSys::initIcons(FX::FXApp*) + 34
3 sumo-gui 0x0000000109679516 GUIApplicationWindow::GUIApplicationWindow(FX::FXApp*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 554
4 sumo-gui 0x000000010967887c main + 620
5 libdyld.dylib 0x00007fff6ea3e2e5 start + 1

Thread 1:
0 libsystem_pthread.dylib 0x00007fff6ec4756c start_wqthread + 0

Thread 2:
0 libsystem_pthread.dylib 0x00007fff6ec4756c start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000012138 rbx: 0x00007fec34f66850 rcx: 0x00007fec34f6687c rdx: 0x00007fec34f66878
rdi: 0x0000000109b29ab0 rsi: 0x00007fec34f66880 rbp: 0x00007ffee658d180 rsp: 0x00007ffee658d0e8
r8: 0x0000000000000001 r9: 0x0000000000000001 r10: 0x00007ffee658dbb8 r11: 0x000000010a8d5030
r12: 0x00007ffee658d230 r13: 0x00007fec37853248 r14: 0x0000000109b29ab0 r15: 0x00007fec37853400
rip: 0x00007fff6ea2f386 rfl: 0x0000000000010202 cr2: 0x000000010a9074fe

Logical CPU: 0
Error Code: 0x00000000
Trap Number: 13
behrisch commented 5 years ago

Sorry we do not have Catalina systems here to test. So it might take some time and will definitely not be solved before the competition ends.

schwamborn commented 4 years ago

Turns out Homebrew defaults to attempting to use existing bottles for newer macOS versions. Until a Catalina bottle has been added to the formula, the current workaround is to compile sumo on Catalina yourself (which worked for me, at least):

brew install --HEAD sumo

BrunoSalerno commented 4 years ago

@schwamborn Unfortunately, it doesn't work for me. I still get the segmentation fault

schwamborn commented 4 years ago

In that case, please post the output of:

echo $SUMO_HOME
brew uninstall sumo
brew install --HEAD sumo
BrunoSalerno commented 4 years ago

SUMO_HOME is not defined. If I define it, it still fails. For example:

% sumo-gui
zsh: segmentation fault  sumo-gui
% echo $SUMO_HOME         

% ls /usr/local/Cellar/sumo/
HEAD-93b75bf
% export SUMO_HOME=/usr/local/Cellar/sumo/HEAD-93b75bf/share/sumo
% which sumo
/usr/local/bin/sumo
% which sumo-gui
/usr/local/bin/sumo-gui
% /usr/local/Cellar/sumo/HEAD-93b75bf/bin/sumo-gui
zsh: segmentation fault  /usr/local/Cellar/sumo/HEAD-93b75bf/bin/sumo-gui
% echo $SUMO_HOME
/usr/local/Cellar/sumo/HEAD-93b75bf/share/sumo

The output of the original homebrew pkg uninstallation is:

% brew uninstall sumo
Uninstalling /usr/local/Cellar/sumo/1.3.1... (999 files, 110.7MB)

The output of brew install --HEAD sumo is:

% brew install --HEAD sumo
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

==> Installing sumo from dlr-ts/sumo
==> Installing dependencies for dlr-ts/sumo/sumo: cmake
==> Installing dlr-ts/sumo/sumo dependency: cmake
==> Downloading https://homebrew.bintray.com/bottles/cmake-3.15.5.catalina.bottl
==> Downloading from https://akamai.bintray.com/46/46b47f448f7690bbed70526a42f27
######################################################################## 100.0%
==> Pouring cmake-3.15.5.catalina.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake
==> Summary
🍺  /usr/local/Cellar/cmake/3.15.5: 5,801 files, 53.4MB
==> Installing dlr-ts/sumo/sumo --HEAD
==> Cloning https://github.com/eclipse/sumo.git
Updating /Users/brunosalerno/Library/Caches/Homebrew/sumo--git
From https://github.com/eclipse/sumo
   93bce80d..93b75bff  master     -> origin/master
==> Checking out branch master
Already on 'master'
Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
HEAD is now at 93b75bff Refactored calculateRotation() and calculateLength() . Refs #5369
Entering 'build/brew'
Entering 'tools/contributed/calibration'
Entering 'tools/contributed/saga'
Entering 'tools/contributed/sumolib4matlab'
Entering 'tools/contributed/traci4matlab'
/Users/brunosalerno/Library/Caches/Homebrew/sumo--git/build/brew
/Users/brunosalerno/Library/Caches/Homebrew/sumo--git/tools/contributed/calibration
/Users/brunosalerno/Library/Caches/Homebrew/sumo--git/tools/contributed/saga
/Users/brunosalerno/Library/Caches/Homebrew/sumo--git/tools/contributed/sumolib4matlab
/Users/brunosalerno/Library/Caches/Homebrew/sumo--git/tools/contributed/traci4matlab
==> cmake ../.. -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDE
==> make
==> make install
==> Caveats
In order to let X11 start automatically whenever a GUI-based SUMO application
(e.g., "sumo-gui") is called, you need to log out and in again.
Alternatively, start X11 manually by pressing cmd-space and entering "XQuartz".

Don't forget to set your SUMO_HOME environment variable:
  export SUMO_HOME="/usr/local/opt/sumo/share/sumo"

Please report any problems with this formula directly to the eclipse/sumo issue tracker:
https://github.com/eclipse/sumo/issues

==> Summary
🍺  /usr/local/Cellar/sumo/HEAD-93b75bf: 1,748 files, 113.8MB, built in 13 minutes 48 seconds
Removing: /Users/brunosalerno/Library/Caches/Homebrew/sumo--1.3.1.high_sierra.bottle.tar.gz... (25.8MB)
==> Caveats
==> cmake
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake
==> sumo
In order to let X11 start automatically whenever a GUI-based SUMO application
(e.g., "sumo-gui") is called, you need to log out and in again.
Alternatively, start X11 manually by pressing cmd-space and entering "XQuartz".

Don't forget to set your SUMO_HOME environment variable:
  export SUMO_HOME="/usr/local/opt/sumo/share/sumo"

Please report any problems with this formula directly to the eclipse/sumo issue tracker:
https://github.com/eclipse/sumo/issues
schwamborn commented 4 years ago

Did you install XQuartz? If not: brew cask install xquartz Also, what happens if you call the command-line version sumo?

BrunoSalerno commented 4 years ago

@schwamborn yes, XQuartz is installed and working. sumo works well.

schwamborn commented 4 years ago

And I assume your XQuartz is also running fine? Might as well try a reinstall of XQuartz. What does brew info sumo say?

BrunoSalerno commented 4 years ago

Yes, it looks like XQuartz is running fine. For example, xclock works. The output of brew info sumo is the following:

% brew info sumo
dlr-ts/sumo/sumo: stable 1.3.1 (bottled), HEAD
Simulation of Urban MObility
https://projects.eclipse.org/projects/technology.sumo
/usr/local/Cellar/sumo/HEAD-93b75bf (1,748 files, 113.8MB) *
  Built from source on 2019-11-12 at 12:54:57
From: https://github.com/dlr-ts/homebrew-sumo/blob/master/Formula/sumo.rb
==> Dependencies
Build: cmake ✔
Required: fox ✔, proj ✔, xerces-c ✔
Optional: ffmpeg ✘, gdal ✔, gl2ps ✘, open-scene-graph ✘, swig ✘
==> Requirements
Required: x11 ✔
==> Options
--with-ffmpeg
    Build with ffmpeg support
--with-gdal
    Build with gdal support
--with-gl2ps
    Build with gl2ps support
--with-open-scene-graph
    Build with open-scene-graph support
--with-swig
    Build with swig support
--HEAD
    Install HEAD version
==> Caveats
In order to let X11 start automatically whenever a GUI-based SUMO application
(e.g., "sumo-gui") is called, you need to log out and in again.
Alternatively, start X11 manually by pressing cmd-space and entering "XQuartz".

Don't forget to set your SUMO_HOME environment variable:
  export SUMO_HOME="/usr/local/Cellar/sumo/1.3.1/share/sumo"

Please report any problems with this formula directly to the eclipse/sumo issue tracker:
https://github.com/eclipse/sumo/issues
schwamborn commented 4 years ago

Could finally reproduce the error and the sumo debug build gave these hints:

$ ../../bin/sumo-guiD 
AddressSanitizer:DEADLYSIGNAL
=================================================================
==50870==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fff656b9386 bp 0x7ffeec8867e0 sp 0x7ffeec883888 T0)
==50870==The signal is caused by a READ memory access.
==50870==Hint: address points to the zero page.
    #0 0x7fff656b9385 in dyld_stub_binder (libdyld.dylib:x86_64+0x2385)
    #1 0x104017366 in GUIIconSubSys::GUIIconSubSys(FX::FXApp*) GUIIconSubSys.cpp:307
    #2 0x1040177b7 in GUIIconSubSys::initIcons(FX::FXApp*) GUIIconSubSys.cpp:597
    #3 0x103384cd9 in GUIApplicationWindow::GUIApplicationWindow(FX::FXApp*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) GUIApplicationWindow.cpp:223
    #4 0x1033853ae in GUIApplicationWindow::GUIApplicationWindow(FX::FXApp*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) GUIApplicationWindow.cpp:221
    #5 0x103380355 in main guisim_main.cpp:86
    #6 0x7fff656c82e4 in start (libdyld.dylib:x86_64+0x112e4)

==50870==Register values:
rax = 0x0000000000012138  rbx = 0x0000608000010d20  rcx = 0x0000608000010d4c  rdx = 0x0000608000010d48  
rdi = 0x0000000109f01180  rsi = 0x0000608000010d50  rbp = 0x00007ffeec8867e0  rsp = 0x00007ffeec883888  
 r8 = 0x0000000000000001   r9 = 0x0000000000000001  r10 = 0x00000001180c5420  r11 = 0x0000000110528030  
r12 = 0x00007ffeec887570  r13 = 0x00007ffeec8875b0  r14 = 0x0000000109f01180  r15 = 0x00007ffeec887530  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libdyld.dylib:x86_64+0x2385) in dyld_stub_binder
==50870==ABORTING
Abort trap: 6

After some digging, it looks like there is something seriously wrong with Xcode 11 which might have led to a faulty Catalina bottle of libfox (a requirement for sumo-gui and netedit). For now, a quick and dirty workaround would be to downgrade to the Mojave bottle of fox:

  1. Uninstall Catalina bottle of fox:

    $ brew uninstall --ignore-dependencies fox
  2. Edit brew Formula of fox:

    $ brew edit fox

    Comment out or delete the following line:

sha256 "c6697be294c9a0458580564d59f8db32791beb5e67a05a6246e0b969ffc068bc" => :catalina

  1. Install Mojave bottle of fox:
    $ brew install fox

This should also work with the Mojave bottle of sumo v1.3.1. I'm afraid that until this issue has been properly resolved, there won't be any Catalina bottle for sumo.

BrunoSalerno commented 4 years ago

@schwamborn great! It works ;). Thanks for the workaround

Tabbi7 commented 4 years ago

Same problem, solved as @schwamborn said! Thank you. ;)

namdre commented 4 years ago

problem not on our end.

ghimirebimal commented 4 years ago

@schwamborn I am unable to comment or delete sha256 "c6697be294c9a0458580564d59f8db32791beb5e67a05a6246e0b969ffc068bc" => :catalina on brew edit fox. It is not letting to type.

readhapark commented 4 years ago

@schwamborn I am unable to comment or delete sha256 "c6697be294c9a0458580564d59f8db32791beb5e67a05a6246e0b969ffc068bc" => :catalina on brew edit fox. It is not letting to type.

You need to enter edit mode which you can by pressing Shift + I, then add # to the start of each line and then finally press ESC and navigate to the bottom to type :x and press enter, this will save the changes you just made.

amitmall12 commented 4 years ago

Could finally reproduce the error and the sumo debug build gave these hints:

$ ../../bin/sumo-guiD 
AddressSanitizer:DEADLYSIGNAL
=================================================================
==50870==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fff656b9386 bp 0x7ffeec8867e0 sp 0x7ffeec883888 T0)
==50870==The signal is caused by a READ memory access.
==50870==Hint: address points to the zero page.
    #0 0x7fff656b9385 in dyld_stub_binder (libdyld.dylib:x86_64+0x2385)
    #1 0x104017366 in GUIIconSubSys::GUIIconSubSys(FX::FXApp*) GUIIconSubSys.cpp:307
    #2 0x1040177b7 in GUIIconSubSys::initIcons(FX::FXApp*) GUIIconSubSys.cpp:597
    #3 0x103384cd9 in GUIApplicationWindow::GUIApplicationWindow(FX::FXApp*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) GUIApplicationWindow.cpp:223
    #4 0x1033853ae in GUIApplicationWindow::GUIApplicationWindow(FX::FXApp*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) GUIApplicationWindow.cpp:221
    #5 0x103380355 in main guisim_main.cpp:86
    #6 0x7fff656c82e4 in start (libdyld.dylib:x86_64+0x112e4)

==50870==Register values:
rax = 0x0000000000012138  rbx = 0x0000608000010d20  rcx = 0x0000608000010d4c  rdx = 0x0000608000010d48  
rdi = 0x0000000109f01180  rsi = 0x0000608000010d50  rbp = 0x00007ffeec8867e0  rsp = 0x00007ffeec883888  
 r8 = 0x0000000000000001   r9 = 0x0000000000000001  r10 = 0x00000001180c5420  r11 = 0x0000000110528030  
r12 = 0x00007ffeec887570  r13 = 0x00007ffeec8875b0  r14 = 0x0000000109f01180  r15 = 0x00007ffeec887530  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libdyld.dylib:x86_64+0x2385) in dyld_stub_binder
==50870==ABORTING
Abort trap: 6

After some digging, it looks like there is something seriously wrong with Xcode 11 which might have led to a faulty Catalina bottle of libfox (a requirement for sumo-gui and netedit). For now, a quick and dirty workaround would be to downgrade to the Mojave bottle of fox:

  1. Uninstall Catalina bottle of fox:
$ brew uninstall --ignore-dependencies fox
  1. Edit brew Formula of fox:
$ brew edit fox

Comment out or delete the following line:

sha256 "c6697be294c9a0458580564d59f8db32791beb5e67a05a6246e0b969ffc068bc" => :catalina

  1. Install Mojave bottle of fox:
$ brew install fox

This should also work with the Mojave bottle of sumo v1.3.1. I'm afraid that until this issue has been properly resolved, there won't be any Catalina bottle for sumo.

Thanks a lot @schwamborn. It fixed the issue.