-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Indexing crashes with dependency Nebulex
and hangs in a loop
#378
Comments
Thank you for tracking this down! Looks like it should be an easy fix. @scohen The problem is that {:__aliases__, [], [{:__MODULE__, [], nil}, :Foo]} so we can't pass the args to There are other cases that we'll need to handle as well, the first I can think of is something like: namespace = ...
defmodule unquote(namespace).Inner do
...
end Basically, the first argument in an |
As an aside, this is insane defmodule Example do
defmodule __MODULE__.Hello do
def world(), do: :boom
end
end that's exactly the same thing as defmodule Example do
defmodule Hello do
def world(), do: :boom
end
end |
Yeah 😅 Was already thinking about opening a merge request in Nebulex to "fix" it. But since it's valid Elixir Syntax, who knows which other projects use this.. |
Agreed we should support it, I was just telling @zachallaun about this nutty syntax in another PR, but my goodness was it ever beaten with the ugly stick. |
@zachallaun is this valid? I tried it, and elixir complains of "using unquote outside of a quote" |
The __aliases__ special form defines three types of aliases, and we were not handling one of them properly. This was made apparent to us in issue #378, where the module defined via `defmodule __MODULE__.Child` was not handled properly. This change fixes that issue, and should handle other aliases as well. Fixes #378
@scohen That's not right. It actually expands to: defmodule Example do
defmodule Elixir.Example.Hello do
def world(), do: :boom
end
end I also thought the same, but I found that out after trying to "fix" Nebulex code:
I'm using that as a workaround for now by pointing other projects to a local copy of Nebulex with that change applied. |
@renatoaguiar so the actual module name is |
No, it will be |
Your explanation makes sense. That's what I initially expected to become. But according to this simple example in That said, with the fix in PR #393 I still get an error, but its a bit different now. I actually think its a different case because it doesn't mention Nebulex in the error anymore:
|
Interesting. I guessed what it would happen in the example based on my Nebulex "fix", but it looks like I was wrong. However, I still don't understand why it seems to behave differently in the Nebulex case. When I tried to just remove the
Anyway, I'm now using the PR #393 instead and the crash loop is gone. |
ok, i'm officially confused; @renatoaguiar did you use your patched nebulex, or the released version? |
Sorry for the confusion. |
now i'm wondering why you're seeing no problems, but @philipgiuliani is. |
There's also a difference with aliases. The second version aliases |
* Made aliases better handle the __aliases__ special form The __aliases__ special form defines three types of aliases, and we were not handling one of them properly. This was made apparent to us in issue #378, where the module defined via `defmodule __MODULE__.Child` was not handled properly. This change fixes that issue, and should handle other aliases as well. Fixes #378
That difference is only visible within the context of |
Yes, aliases are scoped |
I have a problem with indexing in a project where I'm using the Nebulex dependency. I was able to reproduce the problem in a clean project.
Steps to reproduce
mix new example
{:nebulex, "~> 2.5"}
as a dependencyExpected
Indexing works.
Actual result
Indexing crashes and hangs in a loop. The provided log line is repeated every few seconds.
Note: I've tested it in the
za-async-indexing
branch and in themain
branch. I've also tested various Elixir versions.Seems that this is the offending line: https://github.com/cabol/nebulex/blob/v2.5.2/lib/nebulex/adapters/local/backend/shards.ex#L5
Update:
After looking at the Nebulex code, I found the exact offending line. Using
__MODULE__
inside adefmodule
is producing the problem:The text was updated successfully, but these errors were encountered: