Currently I have a large and constantly growing Elixir Phoenix project, and the code scanner or something I have a few issues with (not all the issues exist on smaller code bases either).
- First is that when runnng dev, even with the codereloader and livereloader entirely disabled (code commented out from endpoint.ex) about 10% of the time when requesting the, say,
app.cssfiles it will 404. The server message I can get right quick as just F5’ing enough times causes it:
iex(1)> [debug] ** (Phoenix.Router.NoRouteError) no route found for GET /css/app.css (MyServer.Router) (my_server) web/router.ex:1: MyServer.Router.match_route/4 (my_server) web/router.ex:1: MyServer.Router.do_call/2 (my_server) lib/my_server/endpoint.ex:1: MyServer.Endpoint.phoenix_pipeline/1 (my_server) lib/plug/debugger.ex:122: MyServer.Endpoint."call (overridable 3)"/2 (my_server) lib/my_server/endpoint.ex:1: MyServer.Endpoint.call/2 (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4 (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
Another F5 will usually load it fine (rarely does it 404 twice in a row, but it will sometimes, even trice). This issue I’ve yet to see happen in ‘prod’.
- Second random issue I have are if I do use the code reloader (have it enabled in endpoint) then every-single-request is dead-slow. I’ve had to workaround it by making a
/reloadroute with the codereloader plug to do the reloading otherwise loading a page takes over 10 seconds (12 on average) every request, on routes where the codereloader plug is not on then they resolve in <200ms (where ‘prod’ is <1ms). 10+ seconds on every page load is dreadfully slow. When I load a page on the codereloader plug pipline there is no output from the server logs at all until it completes. If I open
:observerand watch the processes the CPU and IO usage both reach near max utililzation for a short period of time for codereloader plug pipelines. Memory usage grows by about 6 megs during one of those requests then back down, which though not much, seems quite large regardless. The
file_serverprocess has an utterly massive amount of reductions that happen at that time, well over
12000000(not a mis-type of zero’s) in reduction, which is absolute magnitudes above the next highest, which ends up being the Code Reloader code at about
100000(eating 6 megs of memory at the same time before it gets collected). Compared to the next highest process with a reduction count of 75099, which is
Point 1 is the most irritating by far as I’ve yet to find a workaround like
/reload for point 2.
Point 2 is, painful when it happens, I’m guessing I hit some specific bad case for the codereloader plug, it has just been getting worse and worse and worse over time until its current average of 12s per run.
This is on Windows sad to say. Is there something I’m missing to help Point 1, or is there someway to see wtf codereloader is scanning for point 2 with perhaps some way to restrict where it is looking?
EDIT0: A full compile (
mix clean && time mix compile) shows this, so even normal compiling is faster than the codereloader plug…
real 0m9.963s user 0m0.030s sys 0m0.090s
EDIT1: And yes, node_modules and such is at root, everything in web and lib is code and assets.
EDIT2: Oh, and for note, setting