Possible Elixir 1.8.1 bug when redefining module under load?

I just upgraded to Elixir 1.8.1 after running 1.5 for a few years (rock solid, fyi–THANKS!!!)

I’m posting this because I use Elixir on a daily basis and have never come across this issue.

Basically, I modified an existing function Polo.Sim.Model.Ids.insert_start_end_date/2, then reloaded it in IEx. (The function was not itself running in a GenServer, but rather a function being called by another Genserver)

iex> r Polo.Sim.Model.Ids  
{:reloaded, Polo.Sim.Model.Ids, [Polo.Sim.Model.Ids]}
iex> 

Great, working, fine, as you can see below.

Then, the system tried to auto-recompile (I guess it detected changes I made), but then the app crashed with an UndefinedFunctionError.

I also am running a Phoenix 1.4/Ecto app, but since this is really backend stuff, I thought I’d post here.

[info] Updating holdings in Polo.Sim.Model.Holdings for [100675]...
[info] [100675] start_date = 2014-03-19 (oem = 2014-03-31), end_date = 2019-10-31
[info] Updating holdings in Polo.Sim.Model.Holdings for [100676]...
[info] [100676] start_date = 2019-04-11 (oem = 2019-04-30), end_date = 2019-10-31
[info] Loading model_id [100677] Parsley Energy Inc into Polo.Sim.Server...

warning: redefining module Polo.Sim.Model.Ids (current version loaded from _build/dev/lib/polo/ebin/Elixir.Polo.Sim.Model.Ids.beam)
  lib/polo/sim/model/ids.ex:1

[info] Updating holdings in Polo.Sim.Model.Holdings for [100677]...
[info] [100677] start_date = 2014-05-23 (oem = 2014-05-31), end_date = 2019-10-31

.... (works for a while...)

[info] [100717] start_date = 2007-01-03 (first_end_date = 2007-01-31) end_date = 2019-10-31
[info] Loading model_id [100718] Pure Storage Inc into Polo.Sim.Server...
[info] Updating holdings in Polo.Sim.Model.Holdings for [100718]...
[info] [100718] start_date = 2015-10-07 (first_end_date = 2015-10-31) end_date = 2019-10-31
[info] Loading model_id [100719] Phillips 66 into Polo.Sim.Server...
[info] Updating holdings in Polo.Sim.Model.Holdings for [100719]...
[info] [100719] start_date = 2012-04-12 (first_end_date = 2012-04-30) end_date = 2019-10-31
[info] Loading model_id [100720] PTC Inc into Polo.Sim.Server...
[info] Updating holdings in Polo.Sim.Model.Holdings for [100720]...
[info] [100720] start_date = 2007-01-03 (first_end_date = 2007-01-31) end_date = 2019-10-31
[info] Loading model_id [100721] PVH Corp into Polo.Sim.Server...
Compiling 34 files (.ex)
[info] Updating holdings in Polo.Sim.Model.Holdings for [100721]...
[error] GenServer Polo.Sim.Server terminating
** (UndefinedFunctionError) function Polo.Sim.Model.Ids.insert_start_end_date/2 is undefined (module Polo.Sim.Model.Ids is not available)
    (elixir) lib/enum.ex:769: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:769: Enum.each/2
    (polo) lib/polo/sim/server/server.ex:539: Polo.Sim.Server.update_data/0
    (polo) lib/polo/sim/server/server.ex:518: Polo.Sim.Server.handle_cast/2
    (stdlib) gen_server.erl:616: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:686: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", :update}
Compiling lib/polo/web/views/signing_view.ex (it's taking more than 15s)
Compiling lib/polo/web/views/portfolio_view.ex (it's taking more than 15s)
Etc...

Its happened a few time today already (e.g. modifying a function, reloading it in IEx, working for a while, then blowing up on auto-recompile)

Thoughts?

Thanks in advance!!!