fossasia / visdom

A flexible tool for creating, organizing, and sharing visualizations of live, rich data. Supports Torch and Numpy.
Apache License 2.0
10.05k stars 1.13k forks source link

Visdom Always Offline #294

Closed drothermel closed 6 years ago

drothermel commented 6 years ago

I cloned visdom, installed from source (using pip install -e .) and then also ran (python setup.py install) to finish the installation (visdom==0.1.7.2). I started up the server (python -m visdom.server) and was able to bring up visdom in Chrome but it remains offline.

I can only click on the two dropdowns and when I click on "main", the following error prints out:

INFO:tornado.access:200 GET /env (::1) 22.98ms
INFO:tornado.access:200 GET /static/js/main.js?v=b65d2039276f4c6580171aca25bdd5e7 (::1) 3.40ms
INFO:tornado.access:200 GET /static/css/style.css?v=6c9680f97ddb1c54aee0576b12b8ce3b (::1) 1.66ms
INFO:tornado.access:200 GET /favicon.png (::1) 2.62ms
INFO:tornado.access:200 GET /env/socket (::1) 2.49ms
ERROR:tornado.application:Uncaught exception POST /env/env/main (::1)
HTTPServerRequest(protocol='http', host='localhost:8097', method='POST', uri='/env/env/main', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "../anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1541, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "../anaconda3/lib/python3.6/site-packages/visdom-0.1.7.2-py3.6.egg/visdom/server.py", line 718, in post
    load_env(self.state, args, self.subs[sid])
KeyError: None
ERROR:root:ERROR: 500: {'exc_info': (<class 'KeyError'>, KeyError(None,), <traceback object at 0x7f27ef1e5648>)}
ERROR:tornado.access:500 POST /env/env/main (::1) 2.50ms
INFO:tornado.access:304 GET /favicon.png (::1) 2.12ms
INFO:tornado.access:101 GET /vis_socket (::1) 0.49ms

The javascript console then has the following error:

WebSocket connection to 'ws://localhost:8097/env/socket' failed: Error during WebSocket handshake: Unexpected response code: 200 WrappedWebSocket@VM518:164

When I try to run the code example:

>>> import visdom
>>> import numpy as mp
>>> vis = visdom.Visdom()
>>> vis.text('Hello, world')
'window_36084c0e4eddf6'

The following is output but nothing shows up in visdom.

INFO:root:Opened visdom socket from ip: ::1
INFO:tornado.access:200 POST /events (::1) 0.85ms

The javascript console then has the following error:

Post http://localhost:9087/env/env/main 500 (Internal Sever Error)

send | @ | jquery.min.js?v=e071…4711cfc2ab99fe104:4
-- | -- | --
  | ajax | @ | jquery.min.js?v=e071…4711cfc2ab99fe104:4
  | r.(anonymous function) | @ | jquery.min.js?v=e071…4711cfc2ab99fe104:4
  | r.selectEnv | @ | main.js?v=b65d203927…580171aca25bdd5e7:1
  | r | @ | react-dom.min.js?v=8…04ed9a2dac56860e:14
  | a | @ | react-dom.min.js?v=8…04ed9a2dac56860e:12
  | s | @ | react-dom.min.js?v=8…04ed9a2dac56860e:12
  | f | @ | react-dom.min.js?v=8…04ed9a2dac56860e:12
  | m | @ | react-dom.min.js?v=8…04ed9a2dac56860e:12
  | r | @ | react-dom.min.js?v=8…04ed9a2dac56860e:15
  | processEventQueue | @ | react-dom.min.js?v=8…04ed9a2dac56860e:12
  | r | @ | react-dom.min.js?v=8…04ed9a2dac56860e:14
  | handleTopLevel | @ | react-dom.min.js?v=8…04ed9a2dac56860e:14
  | i | @ | react-dom.min.js?v=8…04ed9a2dac56860e:14
  | perform | @ | react-dom.min.js?v=8…04ed9a2dac56860e:15
  | batchedUpdates | @ | react-dom.min.js?v=8…04ed9a2dac56860e:14
  | i | @ | react-dom.min.js?v=8…04ed9a2dac56860e:14
  | dispatchEvent | @ | react-dom.min.js?v=8…04ed9a2dac56860e:14

Are there setup steps that I missed?

JackUrb commented 6 years ago

Hi @drothermel - have you used visdom at any point in the past? This behavior seems somewhat related to having existing env files from a previous build before we added some of the more recent features. Then again the fact that you were able to request the path /env/env/main is somewhat strange, let me investigate that.

JackUrb commented 6 years ago

ws://localhost:8097/env/socket isn't a real address on the visdom server, so I'm actually fairly certain that's the issue - are you just going to localhost:8097 and still getting those addresses?

drothermel commented 6 years ago

Ahh, yup, thats the problem, I went to localhost:8097/env (based on some docs I'll update). When I went to just localhost:8097 then it works as expected, thank you!

JackUrb commented 6 years ago

Yeah that's somewhat related to https://github.com/facebookresearch/visdom/issues/273, the feature used to work properly so the docs had prepopulated an empty env but I haven't had a chance to fix the env access by path yet. Thanks for noting it!

fangxiaoke commented 5 years ago

Hi, I have a similiar problem with you, but what I try to open is still localhost:8097. There always present an red 'offline' button on top right of the web page. And there is nothing wrong in the sever and also prints correct outputs in the command when I try to show something to localhost:8097.

The localhost:8097 page have performed correctly before, but these days it began to go wrong and remains offline as shown in the following figure. I have no idea for what I have done to it. Is this because I have done some wrong operations I didn's know? And I am also very confused about the meaning of this 'offline'.

qq 20181220220615

Looking forward to your reply. Thanks very much in advance!

JackUrb commented 5 years ago

Hi @fangxiaoke - I'll need to know more details about your server logs as well as those in your JavaScript console. Offline means that the client is unable to open a socket with the server, thus no information is being sent. Any number of network configuration problems can cause this issue.

fangxiaoke commented 5 years ago

@JackUrb - Thanks for you reply. I have opened a SSH channel at my local host for 8097 port at local 8098 port in order to view the output page through 'ssh -L 8098:localhost:8097 fangyuke@10.112.220.47' command (fangyuke is my host name on the server).

After running the code example: import visdom import numpy as np vis = visdom.Visdom() vis.text('Hello, world!') vis.image(np.ones((3, 10, 10)))

Following messages output: INFO:tornado.access:200 POST /events (127.0.0.1) 0.31ms INFO:tornado.access:200 POST /events (127.0.0.1) 0.28ms And nothing shows up at my local 8098 port and show the offline as before.

When I try to open a new localhost:8098 page at my local host, the visdom server prints this message: INFO:root:Opened new socket from ip: 127.0.0.1 INFO:tornado.access:200 GET /favicon.png (127.0.0.1) 5.50ms And when I click the inspect button in the chrome, the visdom server prints this message: WARNING:tornado.access:404 GET /static/js/react-grid-layout.min.js.map (127.0.0.1) 1.16ms WARNING:tornado.access:404 GET /static/fonts/layout-bin-packer.js.map (127.0.0.1) 1.04ms WARNING:tornado.access:404 GET /static/css/bootstrap.min.css.map (127.0.0.1) 1.12ms

The console has the following warning: mathjax-MathJax.js?v=8bafcfb6872e60dd315531cc5a91a521:32 WARNING: cdn.mathjax.org has been retired. Check https://www.mathjax.org/cdn-shutting-down/ for migration tips. replaceScript @ mathjax-MathJax.js?v=8bafcfb6872e60dd315531cc5a91a521:32

JackUrb commented 5 years ago

This behavior is particularly strange, as the tornado server believes you are successfully opening up a socket, but the client doesn't agree. It's possible something is going on with the way the socket handler in the client is managing the url that you're visiting, which causes the error. I haven't tried to access via ssh tunnel personally so I'm just trying to think of what could be wrong.

"Offline" by the way means that the JavaScript client is unable to hold an open socket with the server. Generally it's assumed that this happens because the server has been shut down, but it's also possible that something is being configured improperly. Does visdom work for you in a scenario where you don't need to tunnel? (If you have such a scenario)

fangxiaoke commented 5 years ago

@JackUrb Because my server dosen't have a visual interface, I can only use a SSH tunnel to send the page info to my client and thus I can see the varitions in time.

JackUrb commented 5 years ago

Are you not able to access the server directly via ip, like x.x.x.x:8097? In this case you could run your visdom server on the server and access via ip without tunneling. Otherwise you'll have to add a log to https://github.com/facebookresearch/visdom/blob/master/js/main.js in the socket.onerror = socket.onclose = ... function block to log the argument passed to onerror so you can see what's going on. (You'll need to rebuild the JavaScript with npm install; npm run build, and then pip install -e .)

fangxiaoke commented 5 years ago

At this time, after I tried to access the server directly via ip, the page is also at the offline state as before.

fangxiaoke commented 5 years ago

@JackUrb - I'm still confused about my problem. Now I accessed the server directly via ip and it doesn't work. On the 8097 page, only two input boxes and the offline button are available and can be clicked while other items are invalid. And when I click the offline button, terminal output the infomation as below. INFO:tornado.access:101 GET /socket (10.112.221.96) 0.93ms INFO:root:Opened new socket from ip: 10.112.221.96

I have no idea why it cannot work properly as before.

wangyinyan1998 commented 4 years ago

I meet the same problem with fangxiaoke, I want to ask if there are some methods to solve it? I am a new user to visdom.