Display Cannot be Opened: Switching to Batch Mode

I use the CINT session for ROOT through ssh to a server, and typically for the first 15 minutes of my login session I am able to run ROOT and have full use of the display capabilities (I have X11 installed on my Mac OS X). However, if after about 15 minutes I try to run ROOT again, I get this:

Error in TGClient::TGClient: can’t open display “localhost:54.0”, switching to batch mode…
In case you run from a remote ssh session, reconnect with ssh -Y

If my code involves drawing any histograms or displaying any graphics that uses X11, this fails without any error messages.I have tried reconnecting using ssh -Y but this does not solve the problem. The only solution I have is to logout and exit my Terminal session then open a new Terminal and ssh to the server. Naturally this is annoying and eventually consumes a large portion of my day when running several different programs.

Can anyone recommend a permanent solution? Thanks for your help.
Andrew

Try:
ssh -o ServerAliveInterval=99s -o ForwardX11Timeout=596h …

[quote=“Pepe Le Pew”]Try:
ssh -o ServerAliveInterval=99s -o ForwardX11Timeout=596h …[/quote]

I tried this but it threw the message “Bad configuration option: ForwardX11Timeout”. Perhaps I entered the command in the wrong place? I did it exactly as written, in my ssh -X user@domain Terminal session

ssh -o ServerAliveInterval=99s -o ForwardX11Timeout=596h -X user@domain

Excellent, thanks Pepe Le Pew. It seems to be working now, I was able to run a successful CINT session without the reconnection error.

Note that you can set these parameters in your private “${HOME}/.ssh/config” file: [code]Host *
ServerAliveInterval 99s

ForwardAgent yes

ForwardX11 yes
ForwardX11Timeout 596h

ForwardX11Trusted yes[/code]