dave0

dave0

Receiving `:garbage_collect` in tests from Phoenix.LiveViewTest.UploadClient

Hi, I’m trying to test a live_file_input and everything seems to work, but I’m getting a weird error, specifically:

[error] Phoenix.LiveViewTest.UploadClient #PID<0.776.0> received unexpected message in handle_info/2: :garbage_collect

If I blow away my _build, I also get this error on the first run (but not subsequent runs):

[error] Phoenix.LiveViewTest.UploadClient #PID<0.7054.0> received unexpected message in handle_info/2: {:socket_close, #PID<0.7055.0>, {:shutdown, :closed}}

My form is simply the live_file_input along with a submit button. The error happens when submitting the form (render_submit). However, the test will continue and complete successfully.

How would I go about debugging this or getting rid of the error? Currently using version 0.15.4.

The only issue I could find that’s remotely related is the following, but that seems to be taken care of already:

The Test

defmodule MyAppWeb.Settings.ProfileLiveTest do
  use MyAppWeb.ConnCase

  import Phoenix.LiveViewTest

  setup :register_and_log_in_user

  test "GET /settings/profile/update_avatar", %{conn: conn} do
    {:ok, index_live, html} = live(conn, Routes.settings_profile_path(conn, :index))
    assert html =~ "gravatar"
    refute html =~ "Progress:"

    avatar = file_input(index_live, "#change-avatar-form", :avatar, [%{
      last_modified: 1_594_171_879_000,
      name: "elixir.png",
      content: File.read!("test/support/files/elixir.png"),
      size: 8_290,
      type: "image/png"
    }])

    assert render_upload(avatar, "elixir.png") =~ "Progress:"
    assert %{"elixir.png" => _channel_pid} = Phoenix.LiveViewTest.UploadClient.channel_pids(avatar)

    submitted_form =
      index_live
      |> form("#change-avatar-form")
      |> render_submit()

    refute submitted_form =~ "gravatar"
  end
end

Test Output (clean)

➜  mix test

21:59:21.548 [error] Phoenix.LiveViewTest.UploadClient #PID<0.7054.0> received unexpected message in handle_info/2: :garbage_collect

21:59:21.569 [error] Phoenix.LiveViewTest.UploadClient #PID<0.7054.0> received unexpected message in handle_info/2: {:socket_close, #PID<0.7055.0>, {:shutdown, :closed}}

.

Finished in 0.6 seconds
1 test, 0 failures

Randomized with seed 445784

Test Output

➜  mix test

21:44:48.667 [error] Phoenix.LiveViewTest.UploadClient #PID<0.776.0> received unexpected message in handle_info/2: :garbage_collect

.

Finished in 0.8 seconds
1 test, 0 failures

Randomized with seed 485533

Marked As Solved

mcrumm

mcrumm

Phoenix Core Team

The :garbage_collect messages should be suppressed as of v0.15.5 which was just released :slight_smile:

Also Liked

APB9785

APB9785

Creator of ECSx

Indeed they are - thanks!

megalithic

megalithic

Might this still be happening with LiveView 0.19.x? We’re hitting this with tests instrumenting UploadClient

Where Next?

Popular in Questions Top

earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
RisingFromAshes
I've read in another post that it may be possible with a router helper - but I couldn't find an appropriate one, and tbh, I'm still just ...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement