phoenixframework / phoenix_live_reload

Provides live-reload functionality for Phoenix
MIT License
315 stars 90 forks source link

Live Reload initial WS connection always fails after compile #97

Closed oskarkook closed 5 years ago

oskarkook commented 5 years ago

Reproducible with the following steps:

WS connection will be established after first failure, so Live Reload still works, but these exceptions make it really annoying to parse the log.

There's some discussion on the problem here..

josevalim commented 5 years ago

I cannot reproduce it but it does seem to be a race condition. What is your phoenix_live_reload version? Are you on latest? For posterity, here are my dependencies:

$ mix deps
* ranch (Hex package) (rebar3)
  locked at 1.7.1 (ranch) 6b1fab51
  the dependency build is outdated, please run "mix deps.compile"
* telemetry 0.4.0 (Hex package) (rebar3)
  locked at 0.4.0 (telemetry) 8339bee3
  ok
* jason 1.0.0 (Hex package) (mix)
  locked at 1.0.0 (jason) 0f7cfa9b
  ok
* phoenix_pubsub (https://github.com/phoenixframework/phoenix_pubsub.git) (mix)
  locked at 1bc0b25
  the dependency build is outdated, please run "mix deps.compile"
* cowlib (Hex package) (rebar3)
  locked at 2.7.3 (cowlib) a7ffcd09
  the dependency build is outdated, please run "mix deps.compile"
* cowboy (Hex package) (rebar3)
  locked at 2.6.3 (cowboy) 99aa50e9
  the dependency build is outdated, please run "mix deps.compile"
* mime 1.3.1 (Hex package) (mix)
  locked at 1.3.1 (mime) 30ce04ab
  ok
* plug_crypto 1.0.0 (Hex package) (mix)
  locked at 1.0.0 (plug_crypto) 18e49317
  ok
* plug (Hex package) (mix)
  locked at 1.8.2 (plug) 0bcce1da
  the dependency build is outdated, please run "mix deps.compile"
* plug_cowboy (Hex package) (mix)
  locked at 2.1.0 (plug_cowboy) b7576815
  the dependency build is outdated, please run "mix deps.compile"
* phoenix_html (Hex package) (mix)
  locked at 2.13.0 (phoenix_html) 3bad10de
  the dependency build is outdated, please run "mix deps.compile"
oskarkook commented 5 years ago

mix deps result here: https://gist.github.com/oskarkook/b70ac5fbb995e2fb353f7934a5ae67de

Although now I feel like the issue is not LiveReload specific. The same error can be encountered with other Phoenix channels (e.g. LiveView). The issue is actually especially annoying with LiveView as you can end up with a blank page altogether (as opposed to just erroring out once with LiveReload).

josevalim commented 5 years ago

Thanks. Can you please report it on Phoenix instead and copy me? I have a suggestion to fix it. :)