Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when code reloader enabled #65

Closed
davejlong opened this issue Dec 14, 2016 · 4 comments
Closed

Error when code reloader enabled #65

davejlong opened this issue Dec 14, 2016 · 4 comments
Assignees
Labels

Comments

@davejlong
Copy link
Member

Environment

  • Elixir / Hex version (mix hex.info):
$ mix hex.info
Hex:    0.14.1
Elixir: 1.3.3
OTP:    19.1

Built with: Elixir 1.3.4 and OTP 18.3.4.4
  • Node / NPM version (node -v) (npm -v):
$ node -v
v6.9.1
$ npm -v
3.10.8
  • Operating system:
$ uname -a
Darwin Compe.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64

Current behavior

When running a brand new Kitto dashboard installed from the 0.3.0 archive, opening the sample dashboard raises errors in the console:

16:10:40.726 [error] Ranch listener Kitto.Router.HTTP had connection process started with :cowboy_protocol:start_link/4 at #PID<0.1402.0> exit with reason: {{:noproc, {GenServer, :call, [nil, {:get, #Function<1.103310966/1 in Kitto.Notifier.cache/0>}, 5000]}}, {Kitto.Router, :call, [%Plug.Conn{adapter: {Plug.Adapters.Cowboy.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "localhost", method: "GET", owner: #PID<0.1402.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: ["events"], path_params: %{}, peer: {{127, 0, 0, 1}, 51690}, port: 4000, private: %{}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "topics=text,random,buzzwords,random,convergence", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"host", "localhost:4000"}, {"connection", "keep-alive"}, {"accept", "text/event-stream"}, {"cache-control", "no-cache"}, {"user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36"}, {"referer", "http://localhost:4000/dashboards/sample"}, {"accept-encoding", "gzip, deflate, sdch, br"}, {"accept-language", "en-US,en;q=0.8"}], request_path: "/events", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, []]}}

No data is rendered to the dashboard.

Workaround is to disable code reloading by appending the following code to config/config.exs:

config :kitto, reload_code?: false

I've been able to replicate the error from the master branch as well.

Expected behavior

I expect to not have errors in the console from a base install.

@davejlong davejlong self-assigned this Dec 14, 2016
@zorbash
Copy link
Member

zorbash commented Dec 15, 2016

Unfortunately this seems specific to macOS and i cannot reproduce it in Linux.

Can you please try the following steps and provide feedback?

  1. Set :reload_code? to false in config/config.exs
  2. Start a shell using iex -S mix from within your generated dashboard app
  3. Try starting :fs using the lines: https://github.com/kittoframework/kitto/blob/master/lib/kitto/code_reloader.ex#L20
  • Does fs start?
  • Is there any error printed?
  • If you set {:fs, "0.9.2", override: true} in your mix.exs and run mix deps.get does it still fail to start?

@zorbash zorbash added the bug label Dec 15, 2016
@davejlong
Copy link
Member Author

0.9.2 fails because the API is different. fs 0.9.2 doesn't have a start_link/1 method and only a subscribe/0 method.

Manually attempting to start the :fs process results in the following:

iex(1)> :fs.start_link(:default_fs)
** (EXIT from #PID<0.484.0>) an exception was raised:
    ** (UndefinedFunctionError) function :mad_repl.load_file/1 is undefined (module :mad_repl is not available)
        :mad_repl.load_file('deps/fs/priv/mac_listener')
        src/fs.erl:43: :fs.mad_file/1
        src/fs_sup.erl:27: :fs_sup.has_executable/1
        src/fs_sup.erl:17: :fs_sup.init/1
        (stdlib) supervisor.erl:294: :supervisor.init/1
        (stdlib) gen_server.erl:328: :gen_server.init_it/6
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

@davejlong
Copy link
Member Author

Found the solution... 5HT/fs#33. Will open a PR shortly

fusillicode added a commit to fusillicode/kittowidgets that referenced this issue Dec 17, 2016
@zorbash zorbash mentioned this issue Dec 20, 2016
@davejlong
Copy link
Member Author

Upgrade to 2.12.0 works on my Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants