Kitware / paraview-lite

Lite Client to a ParaView server which rely on Web technologies
https://kitware.github.io/paraview-lite/
BSD 3-Clause "New" or "Revised" License
32 stars 17 forks source link

Session timed out error in localhost page #11

Closed rasunag27 closed 3 years ago

rasunag27 commented 3 years ago

Hello, I am working with OpenFOAM Simulations with Ubuntu 16.04. I wanted to use paraview web as a visualizer.

For this, I followed this documentation to set up a paraViewWeb server instance: http://kitware.github.io/paraviewweb/docs/ubuntu_14_04.html

  1. Based on the setup, I webpage runs well, but when I attempt "connect to paraview", I got "Session timed out" error when I try with "http://localhost/lite". As per the issue seen in Paraview web configuration issue, I created the folder directory as suggested in /opt. Still I am facing the same problem.

  2. Below are the details of my launcher.json file and the apache2 configuration file details. I have also given permission as explained in the document.

Launcher.json file

{
    "resources": [ {"port_range": [9001, 9103], "host": "localhost"} ],
    "configuration": {
      "log_dir": "/opt/data/pvw/logs",
      "host": "localhost",
      "proxy_file": "/opt/data/proxy.txt",
      "endpoint": "paraview",
      "sessionURL": "ws://localhost:8080/proxy?sessionId=${id}&path=ws",
      "timeout": 25,
      "upload_dir": "/opt/data/pvw/upload",
      "fields": [],
      "port": 8080,
      "dataFile": "/opt/data/pvw/data/37_left/"
    },
    "properties": {
      "web_path": "/opt/data/pv/pv-5.7.0/share/paraview-5.7/web",
      "python_exec": "/opt/data/pv/pv-5.7.0/bin/pvpython",
      "content": "/opt/data/pv/pv-5.7.0/share/paraview-5.7/web/lite/www",
      "dataDir": "/opt/data/pvw/data"
    },
    "apps": {
      "paraview-lite": {
        "cmd": [
          "${python_exec}", 
          "-dr",
      "${web_path}/lite/server/pvw-lite.py",
          "--port", "${port}",
      "--data", "${dataDir}",
      "--load-file", "${dataFile}",  
          "--authKey", "${secret}",
      "--content", "${content}"
        ],
        "ready_line" : "Starting factory"
      }
  }
}

start.sh file

#!/bin/bash
  export DISPLAY=:0.0
  /opt/data/pv/pv-5.7.0/bin/pvpython /opt/data/pv/pv-5.7.0/lib/python3.7/site-packages/wslink/launcher.py /opt/data/pvw/conf/launcher.json &

Apache 2 config file

  <VirtualHost *:80>
      ServerName   localhost
      ServerAdmin  sunag.ra@company.com
      DocumentRoot /opt/data/www

      ErrorLog /opt/data/logs/apache_error.log
      CustomLog /opt/data/logs/apache_access.log combined

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

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

      # Handle WebSocket forwarding
      RewriteEngine On
      RewriteMap session-to-port txt:/opt/data/proxy.txt
      RewriteCond %{QUERY_STRING} ^sessionId=(.*)&path=(.*)$ [NC]
      RewriteRule ^/proxy.*$  ws://${session-to-port:%1}/%2  [P]
    </VirtualHost>
  1. Also, the page "http://localhost/paraview" displays some python 5.7 error, so I think whether that might be the problem why connection to paraview is not working?

  2. Link to screenshot of paraview 5.7 error shown in "http://localhost/paraview" page: Paraview_error

  3. Any leads will be appreciated.

Regards, Sunag R A

rasunag27 commented 3 years ago

Hi..

I tried the above method with paraview 5.6.2 I found the error in "http://localhost/paraview" stating as

{"error": "id not provided in GET request"}

How to proceed with this..?

Any leads will be appreciated.

Regards,

Sunag R A.

jourdain commented 3 years ago

That response is what it supposed to be based on your configuration. What do you have in /opt/data/www/ and what are you expecting as response for your GET request on /paraview?

The /paraview is reserved for the launcher to start a process for you via a POST not a GET.

rasunag27 commented 3 years ago

Dear Jourdain,

As per the post reply on issue 66, I have removed the upload key and here is the configuration file after removal.

{
    "resources": [ {"port_range": [9001, 9103], "host": "localhost"} ],
    "configuration": {
      "log_dir": "/opt/data/pvw/logs",
      "host": "localhost",
      "proxy_file": "/opt/data/proxy.txt",
      "endpoint": "paraview",
      "sessionURL": "ws://localhost:8080/proxy?sessionId=${id}&path=ws",
      "timeout": 25,
      "fields": [],
      "port": 8080,
      "dataFile": "/opt/data/pvw/data/37_left/"
    },
    "properties": {
      "web_path": "/opt/data/pv/pv-5.7.0/share/paraview-5.7/web",
      "python_exec": "/opt/data/pv/pv-5.7.0/bin/pvpython",
      "content": "/opt/data/pv/pv-5.7.0/share/paraview-5.7/web/lite/www",
      "dataDir": "/opt/data/pvw/data"
    },
    "apps": {
      "paraview-lite": {
        "cmd": [
          "${python_exec}", 
          "-dr",
      "${web_path}/lite/server/pvw-lite.py",
          "--port", "${port}",
      "--data", "${dataDir}",
      "--load-file", "${dataFile}",  
          "--authKey", "${secret}",
      "--content", "${content}"
        ],
        "ready_line" : "Starting factory"
      }
  }
}

I am still getting the list of errors as addressed in the link below.

Paraview_errors_in_localhost/paraview

In /opt/data/www, I have the lite folder which is copied from paraview-5.7.0/share/paraview-5.7/web/lite.

Inside the lite folder, the contents mainly are index.html, ParaviewLite.html, ParaviewLite.js, runtime.js, vendors.js, version.js and some files along with icons folder.

Regards, Sunag R A.

jourdain commented 3 years ago

So why do you go to http://localhost/paraview if you have a /opt/data/www/lite directory. Should you go to http://localhost/lite instead?

Like i said The /paraview is reserved for the launcher to start a process for you via a POST not a GET. The response of a GET on http://localhost/paraview is supposed to be what you are getting since that is an invalid request.

So far everything works as it is supposed to.

rasunag27 commented 3 years ago

Dear Jourdain,

Thank you very much for the quick reponse.

I did go to http://localhost/lite. But, when I click "connect to paraview", I get the following error.

  1. localhost/lite_page

  2. Error in connection

Without Apache, it will run smoothly. Have tried and tested.

Regards,

Sunag R A.

jourdain commented 3 years ago

Your session url is wrong. It should use port 80 not 8080.

On Mon, Jul 26, 2021 at 22:12 Sunag R A @.***> wrote:

Dear Jourdain,

Thank you very much for the quick reponse.

I did go to http://localhost/lite. But, when I click "connect to paraview", I get the following error.

localhost/litepage <https://drive.google.com/file/d/1Z3pOXN0s-ZARYCvkF4ggZ96T4aI6vI8/view?usp=sharing>

Error in connection https://drive.google.com/file/d/1K7lA3eZSpTOYw_FustZ6GDnrugg6kyVO/view?usp=sharing

Without Apache, it will run smoothly. Have tried and tested.

Regards,

Sunag R A.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Kitware/paraview-lite/issues/11#issuecomment-887193629, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACH45QGOGE32TIS5K46O5LTZYW3ZANCNFSM5AXG6FWQ .

rasunag27 commented 3 years ago

Dear Jourdain,

I have changed the session url to port 80 now in the launcher.json file as indicated below.

{
    "resources": [ {"port_range": [9001, 9103], "host": "localhost"} ],
    "configuration": {
      "log_dir": "/opt/data/pvw/logs",
      "host": "localhost",
      "proxy_file": "/opt/data/proxy.txt",
      "endpoint": "paraview",
      "sessionURL": "ws://localhost:80/proxy?sessionId=${id}&path=ws",
      "timeout": 25,
      "fields": [],
      "port": 8080,
      "dataFile": "/opt/data/pvw/data/37_left/"
    }

But the error still persists.

Regards, Sunag R A.

jourdain commented 3 years ago

I bet your Apache can not read your proxy.txt file. Look at the log of apache (+ file permissions), look at the content of that proxy file, look at the launcher log. You need to make sure the network path is clear. You just need to figure out where you miss read the documentation.

rasunag27 commented 3 years ago

Dear Jourdain,

Thanks for the reply.

I will re-look at everything and get back to you with update.

Regards, Sunag R A.

jourdain commented 3 years ago

Look at the network tab to see the request that is made on /paraview. My guess is that you need to remove "--load-file", "${dataFile}", in your command line since you are not providing that arg... Also at that point the --content ... are optional since Apache does the serving of your web content.

rasunag27 commented 3 years ago

Dear Jourdain,

I re-checked the launcher and apache config file. Along with that, I have removed the "--load-file" and also content. Based on this, now I get the paraview tab in background (small tab), but shows "Connection error" in localhost/lite.

In proxy.txt, I get "8784e950-ef69-11eb-b050-402343cf0275 localhost:9103".

In Apache_error log, I get error as invalid host/port: "AH02439: error parsing URL //: Invalid host/port"

I am really new to these works. So, could you guide me again in what way I might have been wrong.??

New config file:

{
    "resources": [ {"port_range": [9001, 9103], "host": "localhost"} ],
    "configuration": {
      "log_dir": "/opt/data/pvw/logs",
      "host": "localhost",
      "proxy_file": "/opt/data/proxy.txt",
      "endpoint": "paraview",
      "sessionURL": "ws://localhost:80/proxy?sessionId=${id}&path=ws",
      "timeout": 25,
      "fields": [],
      "port": 8080
    },
    "properties": {
      "web_path": "/opt/data/pv/pv-5.7.0/share/paraview-5.7/web",
      "python_exec": "/opt/data/pv/pv-5.7.0/bin/pvpython",
      "dataDir": "/opt/data/pvw/data"
    },
    "apps": {
      "paraview-lite": {
        "cmd": [
          "${python_exec}", 
          "-dr",
      "${web_path}/lite/server/pvw-lite.py",
          "--port", "${port}",
      "--data", "${dataDir}",  
          "--authKey", "${secret}"
        ],
        "ready_line" : "Starting factory"
      }
  }
}
jourdain commented 3 years ago

What is the content of the new file created in /opt/data/pvw/logs with the name 8784e950-ef69-11eb-b050-402343cf0275?

rasunag27 commented 3 years ago

Dear Jourdain,

In /opt/data/pvw/logs, I have two files namely apache_access.log and apache_error.log. I ran the server again now. Please check the details of log files and new proxy content below.

  1. Proxy.txt

    729916e8-efb8-11eb-b050-402343cf0275 localhost:9103

  2. Apache_access.log

127.0.0.1 - - [28/Jul/2021:20:58:24 +0530] "POST /paraview/ HTTP/1.1" 200 377 "http://localhost/lite/" "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"

127.0.0.1 - - [28/Jul/2021:20:58:27 +0530] "GET /proxy?sessionId=729916e8-efb8-11eb-b050-402343cf0275&path=ws HTTP/1.1" 400 483 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
  1. Apache_error.log
[Wed Jul 28 20:58:27.087413 2021] [rewrite:error] [pid 8667:tid 139911017514752] (13)Permission denied: [client 127.0.0.1:47458] AH00655: mod_rewrite: can't open text RewriteMap file /opt/data/proxy.txt

[Wed Jul 28 20:58:27.087627 2021] [proxy_wstunnel:error] [pid 8667:tid 139911017514752] [client 127.0.0.1:47458] AH02439: error parsing URL //: Invalid host/port

Is this content what you are asking about?

Thanks and Regards,

Sunag R A.

jourdain commented 3 years ago

The launcher should have created a file here too because of the "log_dir": "/opt/data/pvw/logs", property. That was the content of that file I was looking for. Also ideally I would like to see the content of the /paraview response from your browser network tab from the dev tools.

Another solution since all of that is foreign to you, it might be best to simply used prebuilt docker image where apache and launcher are already properly configured. Maybe see an example here.

rasunag27 commented 3 years ago

Dear Jourdain,

I understood the log file what you are mentioning about. Unfortunately, the launcher has not created any such file. May be I am missing something. I will re-look at those again.

Also, I will look into the docker image post and will try to implement it.

Regards,

Sunag R A.

rasunag27 commented 3 years ago

Dear Jourdain,

The apache server along with launcher is working correctly now. The error was in apache_log which showed "Permission denied", so I changed the directory to /home. Now it is working fine.

Also, the log files are present, I was looking in the wrong directory /opt/data/logs.

Regards,

Sunag R A.

rasunag27 commented 3 years ago

I have one issue facing with respect to color palette.

  1. When I run paraview-lite via terminal, the color palette shows the same which I had modified in pv-current (say red->green).

  2. But, when I run paraview-lite via apache, the color palette sets to default paraview color.

  3. How do I change the apache run paraview to my modified color palette as default.?

Regards,

Sunag R A.

jourdain commented 3 years ago

Remove the "-dr", arg in your command line