Visdom: [Bug] Issue with `Visdom.check_connection` method on the first call

Created on 14 May 2018  路  6Comments  路  Source: fossasia/visdom

Hi,

There is an issue appeared with the version 0.1.8.1 such that in one terminal I run :

# python3 -m visdom.server
Downloading scripts. It might take a while.
It's Alive!
INFO:root:Application Started
You can navigate to http://68a369ae3552:8097

and without exiting the server in the next terminal I run multiple times vis.check_connection() to check the connection:

# python3 -c "import time, visdom; vis=visdom.Visdom(); print([vis.check_connection() for _ in range(5)])"
> [False, True, True, True, True]

# python3 -c "import time, visdom; vis=visdom.Visdom(); print([vis.check_connection() for _ in range(5)])"
> [False, True, True, True, True]

same in the console:

Python 3.5.2 (default, Nov 23 2017, 16:37:01)
>>> import visdom; v = visdom.Visdom(); print(v.check_connection())
False
>>> import visdom; v = visdom.Visdom(); print(v.check_connection())
True
>>> import visdom; v = visdom.Visdom(); print(v.check_connection())
True

Probably, it is not a correct behaviour. Any suggestions to workaround, please ?
Thanks

bug

All 6 comments

Thanks for the catch! I'll see what's going on here and push a fix asap!

@JackUrb thank you!

Hm, I actually am unable to reproduce but I have a suspicion as to where this is coming from - can you try pausing for about a second or so between the visdom initialization and the check connection call?

@JackUrb yes I have the same impression that it is related with the initialization time. I think this could be a workaround:

Python 3.5.2 (default, Nov 23 2017, 16:37:01)
>>> import visdom
>>> import time; vis = visdom.Visdom(); time.sleep(1); print(vis.check_connection())
True

Alright I'll add some checking into the initialization flow so that the visdom object isn't returned until it is actually initialized

@JackUrb thanks, sounds good !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shubhamjain0594 picture shubhamjain0594  路  3Comments

Zumbalamambo picture Zumbalamambo  路  4Comments

JiangPQ picture JiangPQ  路  4Comments

rdevon picture rdevon  路  5Comments

skrish13 picture skrish13  路  4Comments