brainvisa / casa-distro

Unified development environment for BrainVISA projects.
2 stars 1 forks source link

brainvisa crash on Windows/Singularity #232

Closed sapetnioc closed 3 years ago

sapetnioc commented 3 years ago

I can start Anatomist and open a window but BrainVISA main window cannot be displayed (tried wit two X servers : VcXsrv and Xming):

Matlab is not found
SPM8 is not found
SPM12 is not found
SPM8 standalone is not found
SPM12 standalone is not found
cannot import * from Tkinter
cannot import * from Tkinter
Matlab is not found
SPM8 is not found
SPM12 is not found
SPM8 standalone is not found
SPM12 standalone is not found
cannot import * from Tkinter
Matlab and SPM paths are not found
Matlab is not found
SPM8 is not found
SPM12 is not found
SPM8 standalone is not found
SPM12 standalone is not found
Matlab is not found
SPM8 is not found
SPM12 is not found
SPM8 standalone is not found
SPM12 standalone is not found
Matlab is not found
SPM8 is not found
SPM12 is not found
SPM8 standalone is not found
SPM12 standalone is not found
Matlab is not found
SPM8 is not found
SPM12 is not found
SPM8 standalone is not found
SPM12 standalone is not found
exec: /casa/host/build/brainvisa/toolboxes/morphologist/startup.py
connect to computing resource: Draconic
[16076:16157:0126/133328.767404:ERROR:gl_surface_qt.cpp(241)] GLX 1.3 or later is required.
[16076:16157:0126/133328.768085:ERROR:gl_surface_qt.cpp(371)] GLContextHelper::getEGLDisplay() failed.
[16076:16076:0126/133328.807968:ERROR:shared_memory_posix.cc(283)] Creating shared memory in /dev/shm/.org.chromium.Chromium.5bJYha failed: Too many levels of symbolic links
[16076:16076:0126/133328.808016:ERROR:shared_memory_posix.cc(286)] Unable to access(W_OK|X_OK) /dev/shm: Too many levels of symbolic links
[16076:16076:0126/133328.808022:FATAL:shared_memory_posix.cc(288)] This is frequently caused by incorrect permissions on /dev/shm.  Try 'sudo chmod 1777 /dev/shm' to fix.
#0 0x7fc7a6e30aee <unknown>
#1 0x7fc7a6e430e2 <unknown>
#2 0x7fc7a6e49c55 <unknown>
#3 0x7fc7a6bc037c <unknown>
#4 0x7fc7a6bc03d7 <unknown>
#5 0x7fc7a79990f8 <unknown>
#6 0x7fc7a79a27e7 <unknown>
#7 0x7fc7a7992644 <unknown>
#8 0x7fc7a758ee18 <unknown>
#9 0x7fc7a6eb60e6 <unknown>
#10 0x7fc7a6eb61e5 <unknown>
#11 0x7fc7a6eb7189 <unknown>
#12 0x7fc7a64d98f5 QtWebEngineCore::VisitedLinksManagerQt::VisitedLinksManagerQt()
#13 0x7fc7a6481ea1 QtWebEngineCore::BrowserContextAdapter::resetVisitedLinksManager()
#14 0x7fc7a6481ee9 QtWebEngineCore::BrowserContextAdapter::visitedLinksManager()
#15 0x7fc7a64dd613 QtWebEngineCore::WebContentsAdapter::initialize()
#16 0x7fc7967c2a89 sipQWebEnginePage::sipQWebEnginePage()
#17 0x7fc7967c2c32 init_type_QWebEnginePage
#18 0x7fc804606684 <unknown>
#19 0x561adf69c8a8 <unknown>
#20 0x561adf61270e <unknown>
#21 0x561adf62ba29 <unknown>
#22 0x561adf626e0a <unknown>
#23 0x561adf6426a9 <unknown>
#24 0x561adf65ae1e <unknown>
#25 0x561adf65a9ca <unknown>
#26 0x561adf617a6b <unknown>
#27 0x561adf62e750 <unknown>
#28 0x561adf626e0a <unknown>
#29 0x561adf6426a9 <unknown>
#30 0x561adf65ae1e <unknown>
#31 0x561adf62e750 <unknown>
#32 0x561adf626e0a <unknown>
#33 0x561adf6426a9 <unknown>
#34 0x561adf65ae1e <unknown>
#35 0x561adf65a9ca <unknown>
#36 0x561adf617a6b <unknown>
#37 0x561adf62e750 <unknown>
#38 0x561adf626e0a <unknown>
#39 0x561adf6426a9 <unknown>
#40 0x561adf65ae1e <unknown>
#41 0x561adf65a9ca <unknown>
#42 0x561adf617a6b <unknown>
#43 0x561adf62e750 <unknown>
#44 0x561adf626e0a <unknown>
#45 0x561adf6426a9 <unknown>
#46 0x561adf65ae1e <unknown>
#47 0x561adf65a9ca <unknown>
#48 0x561adf617a6b <unknown>
#49 0x561adf62e750 <unknown>
#50 0x561adf626e0a <unknown>
#51 0x561adf62ef53 <unknown>
#52 0x561adf626e0a <unknown>
#53 0x561adf62ef53 <unknown>
#54 0x561adf626e0a <unknown>
#55 0x561adf626879 <unknown>
#56 0x561adf656f5f <unknown>
#57 0x561adf652222 <unknown>
#58 0x561adf6b7b58 <unknown>
#59 0x561adf6297ca <unknown>
#60 0x561adf626e0a <unknown>
#61 0x561adf626879 <unknown>

Aborted
sapetnioc commented 3 years ago

There are some circular symlinks in the image :

Singularity> ls -l /dev/shm
lrwxrwxrwx 1 root root 8 Jan 26 11:43 /dev/shm -> /run/shm
Singularity> ls -l /run/shm
lrwxrwxrwx 1 root root 8 Dec 14 13:13 /run/shm -> /dev/shm
sapetnioc commented 3 years ago

I do not really know yet where the problem comes from and how to fix it. On my running container, there is a /host/run/shm this is a candidate for the symlink /run/shm.

denisri commented 3 years ago

I have perhaps an idea: the web browser in Axon, used to display the docs. It is using QtWebEngine, which is kind of special, has to be started in a given order, etc. You can try disabling it somewhere in axon/master/python/soma/qt4gui/text.py, to see itf it makes any difference.

sapetnioc commented 3 years ago

I tried with QyWebkit instead of QtWebEngine but there is an error later in the code.

Traceback (most recent call last):                                                                                                                                                                        
File "<string>", line 32, in <module>                                                                                                                                                                   
File "/casa/host/build/brainvisa/neuro.py", line 245, in <module>                                                                                                                                         
main()                                                                                                                                                                                                File 
"/casa/host/build/brainvisa/neuro.py", line 194, in main                                                                                                                                             
showMainWindow()                                                                                                                                                                                      
File "/casa/host/build/python/brainvisa/processing/qt4gui/neuroProcessesGUI.py", line 4837, in showMainWindow                                                                                             
_mainWindow = ProcessSelectionWidget()                                                                                                                                                                
File "/casa/host/build/python/brainvisa/processing/qt4gui/neuroProcessesGUI.py", line 4089, in __init__                                                                                                   
self.info = HTMLBrowser(self)                                                                                                                                                                         
File "/casa/host/build/python/brainvisa/processing/qt4gui/neuroProcessesGUI.py", line 1150, in __init__                                                                                                   
btnForward.setDefaultAction(browser.pageAction(QWebEnginePage.Forward))                                                                                                                             
TypeError: pageAction(self, QWebPage.WebAction): argument 1 has unexpected type 'WebAction'                                                                                                             

Anyway, I will try to see what happen with /dev/shm under a barebone Linux. It would be better to fix that, it could cause problems elsewhere. It is just an in-memory file system device.

sapetnioc commented 3 years ago

There is a kernel difference between Windows/WSL2 and GNU/Linux for /dev/shm (AFAIK this is a directory like device that is stored in memory). Under GNU/Linux, Singularity mount it as the host device. Under WSL2, there is no such device on host, /dev/shm is a symlink to /run/shm that is kept as-is by Singularity. On the run image, /run/shm does not exist but on the dev image, it is a symnlink to /dev/shm (creating a symlinks loop).

On WSL2, if /run/shm or /dev/shm is replaced by a writable directory, BrainVISA does not crash anymore. To solve this issue, I plan to modify casa_distro to detect if it is running under WSL2 using a WSL_DISTRO_NAME env var and then mount /tmp to /run/shm.

sapetnioc commented 3 years ago

My fix proposal can work but the symlink /run/shm must not exist in the image. I would have to modify dev image to remove it. But I do not know where it is created, it is not in a system package. If it is required for GNU/Linux (I doubt since it is not in the run image), I would modify casa_distro to mount it from host.

sapetnioc commented 3 years ago

I found another problem with running brainvisa that is finally a good news. BrainVISA cannot be used with XMing X server nor with VcXsrv using default options. It only starts with VcXsrv if I uncheck the "Native OpenGL" option (this options means "use native Windows OpenGL (wgl)"). But, with that configuration, I was able to do volume rendering in Anatomist in full screen. Ok, speed was close to frame per second but with a smaller windows it is ok. I suppose it means that all features can be used with an X server whose development is still active.