DriveSuma crashes on MacOS Sierra

Similar to some recent DriveSuma posts, I’m trying to use DriveSuma on MacOS Sierra (10.12.5) and with July 2017 AFNI, but it reliably crashes. The crashes do not occur on MacOS Yosemite and El Capitan. Thanks for any help.


suma -spec test.spec &
DriveSuma -com surf_cont -load_dset Rain_AV_exp.niml.dset -surf_label AllElectrodes.gii
DriveSuma -com surf_cont -surf_label AllElectrodes.gii -I_sb 1

I get this X11 warning after the version DriveSuma call:

X11 Warning 1:Cannot find callback list in XtAddCallback

I get the following crash log after the second DriveSuma

SUMA_niml_call: Contacting on tcp:127.0.0.1:53219 (6), maximum wait 300.000 sec
(You can change max. wait time with env. SUMA_DriveSumaMaxWait)

Waiting for SUMA to close stream .++ Notice SUMA_niml_workproc (SUMA_niml.c:298 @15:41:07):
++ NIML connection opened from 127.0.0.1 on port 53219 (6th stream)
xp_import_surface: assertion failed: s == NULL
error: xp_import_surface returned: 2
xp_destroy_surface: assertion failed: s != NULL
xp_destroy_surface error: 3
oo Warning SUMA_XErrHandler (SUMA_display.c:4147):
Intercepted X11 error: 0
Will attempt to proceed but trouble might ensue.
++ Notice SUMA_XErrHandler (SUMA_display.c:4148 @15:41:07):
Trace At Xerr
SUMA_XErrHandler
SUMA_glXMakeCurrent
SUMA_cmap_wid_graphicsInit
SUMA_BringUpSurfContTLS
SUMA_viewSurfaceCont
SUMA_Engine
SUMA_nimlEngine2Engine
SUMA_process_NIML_data
suma
Bottom of Debug Stack
– Error SUMA_glXMakeCurrent (SUMA_display.c:341):
Failed in glXMakeCurrent.

SUMA_glXMakeCurrent (via SUMA_GL_ERRS): Looking for OpenGL errors …
SUMA_glXMakeCurrent: No errors found.
– Error SUMA_glXMakeCurrent (SUMA_display.c:343):
Called from SUMA_glXMakeCurrent
SUMA_glXMakeCurrent
SUMA_cmap_wid_graphicsInit
SUMA_BringUpSurfContTLS
SUMA_viewSurfaceCont
SUMA_Engine
SUMA_nimlEngine2Engine
SUMA_process_NIML_data
suma
Bottom of Debug Stack
Error SUMA_cmap_wid_graphicsInit: Failed in SUMA_glXMakeCurrent.
Continuing …
SUMA_cmap_wid_graphicsInit (via SUMA_GL_ERRS): Looking for OpenGL errors …
SUMA_cmap_wid_graphicsInit: No errors found.
xp_import_surface: assertion failed: s == NULL
error: xp_import_surface returned: 2
xp_destroy_surface: assertion failed: s != NULL
xp_destroy_surface error: 3
oo Warning SUMA_XErrHandler (SUMA_display.c:4147):
Intercepted X11 error: 0
Will attempt to proceed but trouble might ensue.
++ Notice SUMA_XErrHandler (SUMA_display.c:4148 @15:41:07):
Trace At Xerr
SUMA_XErrHandler
SUMA_glXMakeCurrent
SUMA_cmap_wid_handleRedisplay
SUMA_InitializeColPlaneShell_SO
SUMA_viewSurfaceCont
SUMA_Engine
SUMA_nimlEngine2Engine
SUMA_process_NIML_data
suma
Bottom of Debug Stack
– Error SUMA_glXMakeCurrent (SUMA_display.c:341):
Failed in glXMakeCurrent.

SUMA_glXMakeCurrent (via SUMA_GL_ERRS): Looking for OpenGL errors …
SUMA_glXMakeCurrent: No errors found.
– Error SUMA_glXMakeCurrent (SUMA_display.c:343):
Called from SUMA_glXMakeCurrent
SUMA_glXMakeCurrent
SUMA_cmap_wid_handleRedisplay
SUMA_InitializeColPlaneShell_SO
SUMA_viewSurfaceCont
SUMA_Engine
SUMA_nimlEngine2Engine
SUMA_process_NIML_data
suma
Bottom of Debug Stack
– Error SUMA_cmap_wid_handleRedisplay (SUMA_xColBar.c:381):
Failed in SUMA_glXMakeCurrent.
Continuing …

Fatal Signal 11 (SIGSEGV) received
SUMA_cmap_wid_display
SUMA_cmap_wid_handleRedisplay
SUMA_InitializeColPlaneShell_SO
SUMA_viewSurfaceCont
SUMA_Engine
SUMA_nimlEngine2Engine
SUMA_process_NIML_data
suma
Bottom of Debug Stack
** AFNI version = AFNI_17.2.02 Compile date = Jul 10 2017
** [[Precompiled binary macosx_10.7_Intel_64: Jul 10 2017]]
** Program Death **
** If you report this crash to the AFNI message board,
** please copy the error messages EXACTLY, and give
** the command line you used to run the program, and
** any other information needed to repeat the problem.
** You may later be asked to upload data to help debug.
** Crash log is appended to file /Users/jmagnotti/.afni.crashlog
…oo Warning SUMA_Wait_Till_Stream_Goes_Bad (SUMA_niml.c:4244):

Failed to detect closed stream after 5000 ms.
(You can change max. wait time with env. SUMA_DriveSumaMaxCloseWait)
Closing shop anyway…NI_stream_write(send): Broken pipe
[1] + Exit 1 suma -spec test.spec

Have you set the DYLD_LIBRARY_PATH to the flatname space directory as described in the installation instructions?

I have it in both ~/.cshrc
setenv DYLD_LIBRARY_PATH /opt/X11/lib/flat_namespace

and ~/.bashrc
export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace

Is there a way to check if AFNI is reading the value correctly?

That is odd. I’m assuming you have tried those DriveSuma commands directly from the command line. Have you checked what “echo $DYLD_LIBRARY_PATH” says?

echo $DYLD_LIBRARY_PATH
/opt/X11/lib/flat_namespace

I’m typing the commands directly into the terminal, they’re not being run within a script.

thanks for your help!

Do any X11 applications work? Can you start afni, suma or even xeyes or xclock?

yes, they all work. that is the puzzling part. I can even click on the UI elements that are equivalent to the DriveSuma command without any issue. It’s only when I use DriveSuma that I get the error.

OK, so maybe this is a networking issue instead of an X11 problem. Let’s try some simple things in tcsh. First, let’s see if this problem is specific to that command or dataset by using the built-in sample surfaces and a simple prompt.

#A string identifying programs launched by this script
set PIF = DriveSumaTest
#Quiet previously launched programs
@Quiet_Talkers -pif $PIF

#Get a free line and tag programs from this script
set NPB = “-npb afni -available_npb_quiet -pif $PIF -echo_edu”

start suma, let it load just it’s own built-in surfaces

suma $NPB &

give suma ample time to wake up (much more than should be needed)

sleep 5
DriveSuma $NPB -com pause “Testing suma”

Now repeat with the spec dataset and same command.

You should get a prompt appearing on the screen.

@Quiet_Talkers -pif $PIF
suma $NPB &
sleep 5
DriveSuma $NPB -com pause “Testing suma”

Thanks for this test script. I noticed that:
[johns-imac:~] jmagnotti% afni -available_npb_quiet
0

Does this mean there is not available ports for communication?

The script runs and shows the pop-up, but I do get an error message, it appears AFTER I click “OK” in the popup.


[johns-imac:~] jmagnotti% DriveSuma $NPB -com pause "Testing suma"

+++ Command Echo:
   DriveSuma -npb 0 -pif DriveSumaTest -com pause Testing suma 

SUMA_niml_call: Contacting on tcp:127.0.0.1:1032 (6), maximum wait 300.000 sec 
(You can change max. wait time with env. SUMA_DriveSumaMaxWait)

++     Notice SUMA_niml_workproc (SUMA_niml.c:298 @09:32:43):
++ NIML connection opened from 127.0.0.1 on port 1032 (6th stream)
--     Error SUMA_SendToSuma (SUMA_niml.c:4595):
You must call SUMA_SendToSuma with action 0 and 1 before action 2.
No Communcation cleanup done.
oo     Warning DriveSuma (SUMA_DriveSuma.c:123):
Failed in SUMA_SendToSuma
Cleanup failed
--     Error SUMA_niml_workproc (SUMA_niml.c:265):
Stream 6 gone bad. Stream closed.

I get a similar error message when I first load the spec file


[johns-imac:~] jmagnotti% suma $NPB -spec test.spec &
[1] 1461

+++ Command Echo:
   suma -npb 0 -pif DriveSumaTest -spec test.spec 


vvvvvvvvvvvvvvvvvvvvvvvvvvvvSurface #1/3(Local Domain Parent), loading ...

vvvvvvvvvvvvvvvvvvvvvvvvvvvvSurface #2/3(Local Domain Parent), loading ...

vvvvvvvvvvvvvvvvvvvvvvvvvvvvSurface #3/3(Local Domain Parent), loading ...
SUMA_Engine: Starting to listen ...

[johns-imac:~] jmagnotti% DriveSuma $NPB -com pause "Testing suma"

+++ Command Echo:
   DriveSuma -npb 0 -pif DriveSumaTest -com pause Testing suma 

SUMA_niml_call: Contacting on tcp:127.0.0.1:1032 (6), maximum wait 300.000 sec 
(You can change max. wait time with env. SUMA_DriveSumaMaxWait)

++     Notice SUMA_niml_workproc (SUMA_niml.c:298 @09:34:54):
++ NIML connection opened from 127.0.0.1 on port 1032 (6th stream)
--     Error SUMA_SendToSuma (SUMA_niml.c:4595):
You must call SUMA_SendToSuma with action 0 and 1 before action 2.
No Communcation cleanup done.
oo     Warning DriveSuma (SUMA_DriveSuma.c:123):
Failed in SUMA_SendToSuma
Cleanup failed
--     Error SUMA_niml_workproc (SUMA_niml.c:265):
Stream 6 gone bad. Stream closed. 

If I try to DriveSuma and load a dset, the message doesn’t seem to get through:


[johns-imac:U01/LIJ118/surf] jmagnotti% suma $NPB -spec test.spec &
[1] 1709
+++ Command Echo:
   suma -npb 0 -pif DriveSumaTest -spec test.spec 

[johns-imac:U01/LIJ118/surf] jmagnotti% DriveSuma -com surf_cont -load_dset Rain_AV_exp.niml.dset -surf_label electrode_lij118.gii
SUMA_niml_call: Contacting on tcp:127.0.0.1:53219 (6), maximum wait 300.000 sec 
(You can change max. wait time with env. SUMA_DriveSumaMaxWait)
.................................................................................................................................

After showing the pop-up window (and getting the initial warning) I can get suma to crash by opening and closing the surface controller twice using the GUI menus (not DriveSuma).


[johns-imac:~] jmagnotti% set PIF = DriveSumaTest 
[johns-imac:~] jmagnotti% @Quiet_Talkers -pif $PIF 
[johns-imac:~] jmagnotti% set NPB = "-npb `afni -available_npb_quiet` -pif $PIF -echo_edu"
[johns-imac:~] jmagnotti% suma $NPB & 
[1] 2201
[johns-imac:~] jmagnotti% 
+++ Command Echo:
   suma -npb 0 -pif DriveSumaTest 


suma: 
     No input specified, loading some toy surfaces...
     Use '.' and ',' to cycle between them.
     See suma -help for assistance.

SUMA_Engine: Starting to listen ...
sleep 5 
DriveSuma $NPB -com pause "Testing suma" [johns-imac:~] jmagnotti% DriveSuma $NPB -com pause "Testing suma" 

+++ Command Echo:
   DriveSuma -npb 0 -pif DriveSumaTest -com pause Testing suma 

SUMA_niml_call: Contacting on tcp:127.0.0.1:1032 (6), maximum wait 300.000 sec 
(You can change max. wait time with env. SUMA_DriveSumaMaxWait)

++     Notice SUMA_niml_workproc (SUMA_niml.c:298 @09:54:11):
++ NIML connection opened from 127.0.0.1 on port 1032 (6th stream)
--     Error SUMA_SendToSuma (SUMA_niml.c:4595):
You must call SUMA_SendToSuma with action 0 and 1 before action 2.
No Communcation cleanup done.
oo     Warning DriveSuma (SUMA_DriveSuma.c:123):
Failed in SUMA_SendToSuma
Cleanup failed
[johns-imac:~] jmagnotti% --     Error SUMA_niml_workproc (SUMA_niml.c:265):
Stream 6 gone bad. Stream closed. 
++     Notice SUMA_XtWarn_handler (SUMA_display.c:4114 @09:54:17):
  X11 Warning 1:Cannot find callback list in XtAddCallback
  Have 1 X11 warnings so far, see Help-->Message Log if curious.
  This notice is shown once for each additional 10 warnings.

xp_import_surface: assertion failed: s == NULL
error: xp_import_surface returned: 2
xp_destroy_surface: assertion failed: s != NULL
xp_destroy_surface error: 3
oo     Warning SUMA_XErrHandler (SUMA_display.c:4147):
Intercepted X11 error: 0
Will attempt to proceed but trouble might ensue.
++     Notice SUMA_XErrHandler (SUMA_display.c:4148 @09:54:20):
Trace At Xerr
        SUMA_XErrHandler
       SUMA_glXMakeCurrent
      SUMA_cmap_wid_graphicsInit
     SUMA_BringUpSurfContTLS
    SUMA_viewSurfaceCont
   SUMA_cb_viewSurfaceCont
  suma
 Bottom of Debug Stack
--     Error SUMA_glXMakeCurrent (SUMA_display.c:341):
Failed in glXMakeCurrent.

SUMA_glXMakeCurrent (via SUMA_GL_ERRS): Looking for OpenGL errors ...
SUMA_glXMakeCurrent: No errors found.
--     Error SUMA_glXMakeCurrent (SUMA_display.c:343):
Called from SUMA_glXMakeCurrent
       SUMA_glXMakeCurrent
      SUMA_cmap_wid_graphicsInit
     SUMA_BringUpSurfContTLS
    SUMA_viewSurfaceCont
   SUMA_cb_viewSurfaceCont
  suma
 Bottom of Debug Stack
Error SUMA_cmap_wid_graphicsInit: Failed in SUMA_glXMakeCurrent.
 	Continuing ...
SUMA_cmap_wid_graphicsInit (via SUMA_GL_ERRS): Looking for OpenGL errors ...
SUMA_cmap_wid_graphicsInit: No errors found.
xp_import_surface: assertion failed: s == NULL
error: xp_import_surface returned: 2
xp_destroy_surface: assertion failed: s != NULL
xp_destroy_surface error: 3
oo     Warning SUMA_XErrHandler (SUMA_display.c:4147):
Intercepted X11 error: 0
Will attempt to proceed but trouble might ensue.
++     Notice SUMA_XErrHandler (SUMA_display.c:4148 @09:54:20):
Trace At Xerr
        SUMA_XErrHandler
       SUMA_glXMakeCurrent
      SUMA_cmap_wid_handleRedisplay
     SUMA_InitializeColPlaneShell_SO
    SUMA_viewSurfaceCont
   SUMA_cb_viewSurfaceCont
  suma
 Bottom of Debug Stack
--     Error SUMA_glXMakeCurrent (SUMA_display.c:341):
Failed in glXMakeCurrent.

SUMA_glXMakeCurrent (via SUMA_GL_ERRS): Looking for OpenGL errors ...
SUMA_glXMakeCurrent: No errors found.
--     Error SUMA_glXMakeCurrent (SUMA_display.c:343):
Called from SUMA_glXMakeCurrent
       SUMA_glXMakeCurrent
      SUMA_cmap_wid_handleRedisplay
     SUMA_InitializeColPlaneShell_SO
    SUMA_viewSurfaceCont
   SUMA_cb_viewSurfaceCont
  suma
 Bottom of Debug Stack
--     Error SUMA_cmap_wid_handleRedisplay (SUMA_xColBar.c:381):
Failed in SUMA_glXMakeCurrent.
 	Continuing ...

Fatal Signal 11 (SIGSEGV) received
       SUMA_cmap_wid_display
      SUMA_cmap_wid_handleRedisplay
     SUMA_InitializeColPlaneShell_SO
    SUMA_viewSurfaceCont
   SUMA_cb_viewSurfaceCont
  suma
 Bottom of Debug Stack
** AFNI version = AFNI_17.2.02  Compile date = Jul 10 2017
** [[Precompiled binary macosx_10.7_Intel_64: Jul 10 2017]]
** Program Death **
** If you report this crash to the AFNI message board,
** please copy the error messages EXACTLY, and give
** the command line you used to run the program, and
** any other information needed to repeat the problem.
** You may later be asked to upload data to help debug.
** Crash log is appended to file /Users/jmagnotti/.afni.crashlog

So you’re getting suma to crash reliably with just opening and closing the surface object control, then opening it again manually? Does this happen with the sample surfaces or just your spec file surface. If it’s specific to your surface, then it might good for you to send me the surface and the niml.dset too.

sorry, I should have been more clear. I can actually crash SUMA by opening/closing the surface controller twice, even when just the toy surfaces are loaded. I tried upgrading and downgrading XQuartz (2.7.8 vs. 2.7.11) but that hasn’t made a difference.

There seems to be a bug in Sierra’s Xquartz and/or OpenGL interface. We have been able to reproduce this behavior on a virtual machine here, so we will be able to try out some things. As a work-around in the meantime, consider keeping the object controller permanently open by making this the first DriveSuma command.

DriveSuma $NPB -com surf_cont -view_surf_cont y

If you need to move that controller to a specific location on the screen, you can do this by driving suma to put the controller in a specific spot. Create a small file with just these lines:

cat contxy.niml.vvs

<Viewer_Visual_Setting
ContX = “200”
ContY = “1000”
/>

Then move the suma controller to that location with
DriveSuma -com viewer_cont -load_view contxy.niml.vvs

Thanks for this workaround. We’re still getting occasional crashes from extended use of DriveSuma, but we’ll keep at it.