Search code examples
matlabx11-forwarding

When Matlab crashes, X11 connection breaks on Mac OS


I'm using MATLAB (2013a) on a linux machine remotely. I'm forwarding X11 via ssh using ssh -X (OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013). The X11 server is XQuartz 2.7.4 (xorg-server 1.13.0) on a Mac OS 10.8.5.

When my MATLAB crashes, it somehow kills the X11 connection, and I need to reconnect via ssh to re-estabilish a fresh X11, otherwise MATLAB refuses to start. Is it normal for an X11 application to do things like this? Is there a way to fix the X11 without reconnecting via ssh?

This happens when I don't have splash (-nosplash), no gui, no editor, no plots as well.

EDIT: I am running MATLAB over a shell (bash) inside tmux (or sometimes screen).


Solution

  • You need to have the DISPLAY variable set properly for X11 forwarding to work correctly -- something ssh -X or ssh -Y should do for you. What is the value of DISPLAY before and after the crash (echo $DISPLAY)? It should be something like localhost:10.0. I'm wondering if the variable gets messed up does not exit cleanly.

    Also, try using -Y instead of -X to see if that makes any difference. If that doesn't help, try adding ForwardX11Trusted yes in /etc/ssh/ssh_config.