zekedou
Warning: mtime was set to the future - triggered by two rapid successive calls to Elixir compiler (possible bug - need your help to test)
Although parts of the following describe behavior observed in Phoenix, this is not a Phoenix bug (I’ll explain why later). It appears to be an Elixir bug, so I’m posting this in the “Elixir” category.
The possible bug
Recently, I encountered the following warning while developing a Phoenix application:
warning: mtime (modified time) for "lib/demo_web/controllers/page_html.ex" was set to the future, resetting to now
Have any of you encountered this issue? I haven’t seen any similar reports in the community.
To reproduce it:
- Create an app:
mix phx.new demo --no-ecto --no-live --no-tailwind - Enter the dev environment:
cd demo && iex -S mix phx.server - Visit http://localhost:4000 in your browser and keep the tab open (this is necessary, as it triggers the edge case)
- Modify
demo/lib/demo_web/controllers/page_html/home.html.heexand save - The warning should appear in your IEx. If not, repeat step 4 a few more times.
The chain of logic leading to the warning:
- We modify
demo/lib/demo_web/controllers/page_html/home.html.heex. Phoenix.LiveReloaderdetects the change and pushes an event to the browser.- The browser requests
/to refresh, triggeringPhoenix.CodeReloaderto reload the code. - The refreshed page requests
/phoenix/live_reload/socketto re-establish live reloading, triggeringPhoenix.CodeReloaderto reload the code again.
I suspect the warning is caused by two rapid successive calls to Phoenix.CodeReloader.reload/2, which in turn calls mix compile.elixir. To verify this, I created a minimal reproduction: GitHub - plastic-gun/elixir-compile-warning-1 · GitHub — and indeed, the warning reproduced.
I need help testing whether this is consistently reproducible across platforms and elixir versions. So far I’ve only tested on macOS — it would be great if those on Linux and Windows could test as well.
If this does turn out to be a bug, we’ll have already collected the necessary environment information.
How to help?
Run the project at GitHub - plastic-gun/elixir-compile-warning-1 · GitHub and report your results in the following format:
Reproduced?: Y/N
OS: <like macOS 15.7.5>
Erlang and Elixir:
<output of `elixir --version`>
Marked As Solved
josevalim
Fixed in main as part of the issue you opened. They both had the same root cause. Please give main a try and let me know how it goes!
Thank you for all reports! Also please double check we haven’t reintroduced View modules are not recompiled after triggering compilation error of unmatched tag in template files. · Issue #6476 · phoenixframework/phoenix · GitHub. ![]()
Also Liked
gtcode
Reproduced: Y
OS: Ubuntu 24.04.3 LTS
Erlang and Elixir:
Erlang/OTP 28 [erts-16.2] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [jit:ns]
Elixir 1.19.5 (compiled with Erlang/OTP 28)
zekedou
All the issues have been checked again:
- Elixir issue #15277 has been fixed.
- Elixir issue (mentioned here) has been fixed.
- Phoenix issue #6476 has been fixed.
Thanks! @josevalim @gtcode
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









