plotly-resampler icon indicating copy to clipboard operation
plotly-resampler copied to clipboard

Mimic Dash error if running app on port already in use

Open jayceslesar opened this issue 3 years ago • 6 comments

closes #73.

In Dash if you try to do this you get an output like:

Address already in use
Port 8080 is in use by another program. Either identify and stop that program, or start the server with a different port.

So we mimic that here.

jayceslesar avatar Jun 19 '22 23:06 jayceslesar

Hi @jayceslesar!

Thanks for contributing, looks promising! 👏🏼 I did not immediately find the dash implementation; could you provide a link to which snippet you based this implementation on?

TODO:

  • [ ] Review and compare with dash implementation
  • [ ] Add tests

jonasvdd avatar Jun 20 '22 07:06 jonasvdd

Codecov Report

Merging #79 (ea4c3aa) into main (f25cc4e) will decrease coverage by 0.38%. The diff coverage is 57.14%.

@@            Coverage Diff             @@
##             main      #79      +/-   ##
==========================================
- Coverage   98.11%   97.73%   -0.39%     
==========================================
  Files          10       10              
  Lines         743      750       +7     
==========================================
+ Hits          729      733       +4     
- Misses         14       17       +3     
Impacted Files Coverage Δ
...tly_resampler/figure_resampler/figure_resampler.py 86.56% <57.14%> (-3.44%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f25cc4e...ea4c3aa. Read the comment docs.

codecov-commenter avatar Jun 20 '22 07:06 codecov-commenter

also looks like this is the second time the failing test has failed on different python versions while the other two passed haha. Not a stranger to those kinds of tests

jayceslesar avatar Jun 23 '22 00:06 jayceslesar

Hi @jayceslesar

I did some further digging today and found out why it takes (quite) some time before jupyter-dash throws an OSError when the address is already in use. In the run method multiple times they check if an alive message from the address can be received (see code below)

https://github.com/plotly/jupyter-dash/blob/b6dad2689af96b70b796ae3d766a9c56d306c47d/jupyter_dash/jupyter_app.py#L323-L342

As this apparently intended behavior of jupyter-dash, I'm not really keen on overwriting this in this library (as it is not at all our responsibility).

What do you think of this? Or were you targeting another bug / issue with this PR (that I am missing at the moment)?

Cheers, Jeroen

jvdd avatar Jun 28 '22 06:06 jvdd

I think taking no action is a fine way to deal with this -- I completely agree that it is not this libraries job to better handle how things are treated upstream. Feel free to close

jayceslesar avatar Jun 28 '22 12:06 jayceslesar

Good to close this and #73 ?

jayceslesar avatar Jul 15 '22 02:07 jayceslesar

I experienced (plotly-resampler 0.8.0) that this dash app error might keep "hanging" indefinitely, seems to be caused by a dash-werkzeug combination. Will need to further look into this (fyi: @jvdd @jayceslesar )

https://github.com/plotly/jupyter-dash/issues/103#issue-1385617801

Will create a new issue for this later this day.

jonasvdd avatar Oct 11 '22 07:10 jonasvdd