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

failed to start child: Mneme.watch.TestRunner #95

Closed
tcoopman opened this issue Oct 21, 2024 · 9 comments · Fixed by #97
Closed

failed to start child: Mneme.watch.TestRunner #95

tcoopman opened this issue Oct 21, 2024 · 9 comments · Fixed by #97
Labels
bug Something isn't working

Comments

@tcoopman
Copy link

tcoopman commented Oct 21, 2024

I'm a bit bumped. I was running mneme.watch just fine, and suddenly I get this all the time:

mix mneme.watch
** (EXIT from #PID<0.95.0>) shutdown: failed to start child: Mneme.Watch.TestRunner
    ** (EXIT) an exception was raised:
        ** (ArgumentError) could not fetch application environment :after_suite for application :ex_unit because the application was not loaded nor configured
            (elixir 1.17.2) lib/application.ex:778: Application.fetch_env!/2
            lib/ex_unit.ex:460: ExUnit.after_suite/1
            (mneme 0.9.2) lib/mneme/watch/test_runner.ex:40: Mneme.Watch.TestRunner.init/1
            (stdlib 6.0) gen_server.erl:2057: :gen_server.init_it/2
            (stdlib 6.0) gen_server.erl:2012: :gen_server.init_it/6
            (stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3

running mix test works fine

This is on mneme 0.9.2

@zachallaun
Copy link
Owner

Hmm... There are some scenarios in which mneme.watch has to run System.restart(), which unloads applications. I have an idea for a fix. A couple questions:

  1. It happens consistently now, every time you run mix mneme.watch, even from scratch? Or does it run the first one fine, and then fail on reload?
  2. Try deleting _build/test; does it still fail?

@tcoopman
Copy link
Author

  1. it was on every run consistently
  2. deleting _build/test fixes it again

@zachallaun zachallaun added the bug Something isn't working label Oct 21, 2024
@zachallaun
Copy link
Owner

Okay, thanks! Knowing that deleting _build/test fixes it may help me reproduce the issue.

@tcoopman
Copy link
Author

tcoopman commented Oct 21, 2024

it reproduces for me quite easily.

I run mix mneme.watch --stale then kill it with ctrl+c and then the next time it crashes.

I'll see if it happens on other params to mneme.watch as well

@zachallaun
Copy link
Owner

zachallaun commented Oct 21, 2024

I'm not able to reproduce it yet, even using --stale. Since you can reproduce, could you please try:

  1. Get mneme.watch into the bad state, such that running mix mneme.watch --stale immediately crashes with the :ex_unit config error
  2. Instead of deleting all of _build/test, delete only _build/test/lib/YOUR_APP/.mix/mneme.watch.restart
  3. Run mix mneme.watch --stale and check whether the crash persists

@zachallaun
Copy link
Owner

@tcoopman Actually, I think the fix might be simpler than I thought. Could you please try this branch and let me know if the problem persists?

{:mneme, github: "zachallaun/mneme", ref: "za-issue-95", only: :test}

@tcoopman
Copy link
Author

@zachallaun thanks, that seems to fix it, will keep running that for now.

Regarding your previous suggestion:

  1. It's the same on mix mneme.watch as well
  2. I don't have _build/test/lib/YOUR_APP/.mix/mneme.watch.restart, only these:
├── cached_dot_formatter
├── compile.app_cache
├── compile.elixir
├── compile.elixir_scm
├── compile.lock
└── compile.protocols

@zachallaun
Copy link
Owner

Glad that fixes it!

I'll publish a release for this and #96 momentarily.

@zachallaun
Copy link
Owner

Will publish v0.9.3 once CI completes on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants