the fly app fails on semantic search
ndrean opened this issue ยท 7 comments
You can record and listen to your audio but then the app fails.
What do you see in the logs?
๐ค Interesting.
The logs say:
** (File.CopyError) could not copy from "/tmp/plug-1712-Rp-C/live_view_upload-1712263920-187903422807-3" to "/app/priv/static/uploads/tmp.wav34a10671-5ec5-49c1-84b6-3439a10e044f.wav": no such file or directory
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (elixir 1.16.2) lib/file.ex:864: File.cp!/3
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (app 0.1.0) lib/app_web/live/page_live.ex:218: anonymous fn/2 in AppWeb.PageLive.handle_progress/3
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (phoenix_live_view 0.20.14) lib/phoenix_live_view/upload_channel.ex:20: Phoenix.LiveView.UploadChannel.consume/3
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (phoenix_live_view 0.20.14) lib/phoenix_live_view/upload.ex:264: Phoenix.LiveView.Upload.consume_uploaded_entry/3
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (app 0.1.0) lib/app_web/live/page_live.ex:216: AppWeb.PageLive.handle_progress/3
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (phoenix_live_view 0.20.14) lib/phoenix_live_view/channel.ex:181: anonymous fn/4 in Phoenix.LiveView.Channel.handle_info/2
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] (phoenix_live_view 0.20.14) lib/phoenix_live_view/channel.ex:1413: Phoenix.LiveView.Channel.write_socket/4
2024-04-04T20:52:00.870 app[080e325c904168] mad [info] Last message: %Phoenix.Socket.Message{topic: "lv:phx-F8Mu6QMK6OeJgABh", event: "progress", payload: %{"entry_ref" => "0", "event" => nil, "progress" => 100, "ref" => "phx-F8Mu6VEeIOmfhCEj"}, ref: "16", join_ref: "4"}
However, when running on localhost, it seems to be working.
I don't know if this may be related with the on-going DDOS attack on fly.io
right now.
@nelsonic while on the topic, I think we should turn off the machine indefinitely. There's a higher volume of requests and having it running (even with the volume not redownloading optimization) is costing a fair amount of money. People can run it on localhost
for themselves.
I was also really wondering about the costs of running models on GPUs......Good to know
Some thoughts about the error:
"/app/priv/static/uploads/tmp.wav34a10671-5ec5-49c1-84b6-3439a10e044f.wav": no such file or directory
- The failing line is 217 in "page_live.ex":
https://github.com/ndrean/image-classifier/blob/00a5b6183bb7ab6ee888d2b80d6750a954065e41/lib/app_web/live/page_live.ex#L218
Maybe the format "tmp.wavuuid.wav" gives some trouble to the underlying OS????
This is because I set:
#page_live.ex
@tmp_wav Path.expand("priv/static/uploads/tmp.wav").....line 24
# set it in this assigns line 48
# use it line 217
tmp_wav = assigns.tmp_wav <> Ecto.UUID.generate() <> ".wav"
:ok = File.cp!(path, tmp_wav)
Maybe you can try with:
- @tmp_wav Path.expand("priv/static/uploads/tmp.wav").....line 24
+ @tmp_wav Path.expand("priv/static/uploads/tmp").....line 24
- no directory:
There is a check_or_create line:ok = File.mkdir_p!(@upload_dir)
in the GenServerApp.KnnIndex
at line 23. This Genserver is started conditionnally by default in "Application.ex" so I guess this is not the reason.
@ndrean shouldn't be OS-related at all since it has been working for the past two weeks just fine ๐ค . It's hard to not associate it with the DDOS attack that happened yesterday. Further latency probably made it so the audio file was not properly created
@LuchoTurtle
I just tested it live yesterday, so I thought the mistake (?) was mine. So good to know it worked.
So we should close this one!