Closed paulo-silva closed 5 months ago
Hi @paulo-silva. We need a mechanism to reproduce the warning, otherwise there isn't much we can do about it. :(
Hi @paulo-silva. We need a mechanism to reproduce the warning, otherwise there isn't much we can do about it. :(
@josevalim that makes sense, I'll try to reproduce it in a project example
@josevalim I tried to reproduce that in a project example, but I'm unable to; I guess the issue is related to the project size. Is there any chance we can huddle and I can show you the issue in the real project?
I tried the strategy proposed in slack ecto channel as a temp workaround, but I started getting deadlocks
After some puzzling with this same error for me it was caused by having a module attribute reference to a different schema. Though most of the times doing that doesn't seem to cause any issues but in 1 case it caused the same error for me. Giving a warning everytime trying to build it.
@organization_role_id_admin OrganizationRole.admin_role_id()
Schema gets warning from has_many in organizations -> organization_memberships while this memberships references a third schema with the module attribute.
I guess because it waits for the belongs_to to be ready and the organization waits for the has_many to be ready causing the issue.
I saw another difference in our project from before the refactor that the has_many was removed from organization_role -> organization_memberships
When I readd the has_many it will solve the warning.
I guess because it is referenced in the has_many it knows to wait for it or something and no longer give the compile warning.
After changing @organization_role_id_admin OrganizationRole.admin_role_id()
to a static value it seems to work great: @organization_role_id_admin "foobar"
so probably some race condition in the compiler like nulian said.
Closing it as #4293 was reopened.
Elixir version
1.16.0
Database and Version
PostgreSQL 15.2
Ecto Versions
3.11.1
Database Adapter and Versions (postgrex, myxql, etc)
postgrex 0.17.4
Current behavior
While bumping elixir on my project, I noticed while compiling a warning like:
Checking this previous issue: https://github.com/elixir-ecto/ecto/issues/4293 - elixir 1.16 was meant to fix this problem, but some devs are still experiencing this problem.
Expected behavior
This warn should not happen, like it wasn't when using previous versions of elixir.