Error in <RootX11IOErrorHandler>: fatal X11 error (connection to server lost?!)

Hello all,

I am having the following problem in Xquartz when I tried to open the .root file. Xquartz is quit unexpectedly and got the following error.
root [1] h_missing_piplus_piminus->Draw()
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1
root [2] Error in : fatal X11 error (connection to server lost?!)

**** Save data and exit application ****

I used ssh remote connection.
Recently I installed Xquartz 2.8.1. (I am not sure my previous version of XQuartz, but haven’t had any problem)
Any help would be greatly appreciated.
My Mac version-MacOS Big Sur: 11.5.1

Thanks
Dil

I have XQuartz 2.8.1 with MacOS 12.3.1 (Monterey) and I can display graphics remotely via ssh.