Kitware/paraviewweb

failed: Error during WebSocket handshake

Closed this issue · 3 comments

Hello Paraviewweb Team,

I'm trying to run a custom project using paraviewweb 5.7.1. To achieve that, I use a custom docker image based on pvw-v5.7.1-osmesa-py3 with a fully external application. You can find the launcher (config.json) here.

I am doing some tests locally and I start the server the following way: docker run -v /Users/skoudoro/Software/fury-web:/pvw -p 127.0.0.1:9000:80 -e "SERVER_NAME=localhost:9000" -e "PROTOCOL=ws" -ti furyweb-0.4.0

The client is sending {"sessionManagerURL":"http://localhost:9000/paraview/","application":"fury"}.

I can see on the log file that my server is starting correctly, the proxy-mapping.txt file looks correct too, but the response is WebSocket connection to 'ws://127.0.0.1:9000/ws' failed: Error during WebSocket handshake: Unexpected response code: 404

Capture d’écran 2020-06-15 à 17 24 41

Do you have any ideas on what might be happening? I'm stuck at this point and couldn't make it work.

Thank you

Hi @skoudoro I'm not exactly sure what's going on in your case either. You've shared your launcher config, and the Dockerfile used to build your custom application (I guess you needed it just to get rid of buggy scipy?). Those seem to make sense to me. I see a CORS error in your console, can you validate the configuration of the apache running in the container to make sure all the traffic is going through there properly? Do you have any endpoints.txt in your mounted pvw directory? It would be used to modify the apache config upon container startup. It's weird that the process seems to be starting correctly, because it looks like it's the POST to /paraview (the attempt to launch) that is failing.

Hi @scottwittenburg,

Thank you for your feedback.

Do you have any endpoints.txt in your mounted pvw directory?

yes, I have one. you can see it here

can you validate the configuration of the apache running in the container to make sure all the traffic is going through there properly?

I run docker exec -it image_name cat /etc/apache2/sites-available/001-pvw.conf and I got the following result:

<VirtualHost *:80>
  DocumentRoot /pvw/www/
  ErrorLog /var/log/apache2/001-pvw_error.log
  CustomLog /var/log/apache2/001-pvw_access.log combined

  <Directory /pvw/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
  </Directory>

  Alias "/pvw/glance" "/opt/paraview/share/paraview-5.7/web/glance/www/"

  <Directory /opt/paraview/share/paraview-5.7/web/glance/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  Alias "/pvw/lite" "/opt/paraview/share/paraview-5.7/web/lite/www/"

  <Directory /opt/paraview/share/paraview-5.7/web/lite/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  Alias "/pvw/divvy" "/opt/paraview/share/paraview-5.7/web/divvy/www/"

  <Directory /opt/paraview/share/paraview-5.7/web/divvy/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  Alias "/pvw/visualizer" "/opt/paraview/share/paraview-5.7/web/visualizer/www/"

  <Directory /opt/paraview/share/paraview-5.7/web/visualizer/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  Alias "/pvw/flow" "/opt/paraview/share/paraview-5.7/web/flow/www/"

  <Directory /opt/paraview/share/paraview-5.7/web/flow/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  Alias "/pvw" "/pvw/apps/pvw/www/"

  <Directory /pvw/apps/pvw/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  Alias "/horizon" "/pvw/apps/horizon/www/"

  <Directory /pvw/apps/horizon/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  Alias "/fury" "/pvw/apps/fury/www/"

  <Directory /pvw/apps/fury/www/>
      Options Indexes FollowSymLinks
      Order allow,deny
      Allow from all
      AllowOverride None
      Require all granted
    </Directory>

  # APPLICATION-ENDPOINTS

  # Handle launcher forwarding
  ProxyPass /paraview http://localhost:9000/paraview

  # Handle WebSocket forwarding
  RewriteEngine On
  RewriteMap session-to-port txt:/opt/launcher/proxy-mapping.txt
  RewriteCond %{QUERY_STRING} ^sessionId=(.*)&path=(.*)$ [NC]
  RewriteRule ^/proxy.*$  ws://${session-to-port:%1}/%2  [P]
</VirtualHost>

It's weird that the process seems to be starting correctly, because it looks like it's the POST to /paraview (the attempt to launch) that is failing.

I agree that it is weird. On the log, I get the following server message:

3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0]
Auth-key h16RroCC7aePaVUi
Initialization  --- OK
Starting FURY SERVER
wslink: Starting factory
CRITICAL:twisted:wslink: Starting factory

Fixed, it seems, it was due to my js client. Closing and Thanks for the help