-
Notifications
You must be signed in to change notification settings - Fork 228
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
Segmentation fault based on Mix.exs compiler order #93
Comments
Would you mind sending me the test project? |
Sure, the code I just figured that out on is this code: https://github.com/cgregfreeman/phoenix_rust_ports_and_nifs The README isn't quite in sync yet |
It seems like the problem with having the :phoenix and :gettext compilers before rustler is that they seem to load modules in the user code. This causes the NIF to be loaded before the :rustler compiler is actually run. As for why there is a segfault, I am really not sure. I am unable to reproduce it. I have tried reproducing on both the debug build and with valgrind as well. There are no failed assertions or detected memory corruption by valgrind. Unsure what else I can do. It still worries me though. The fact that there is a segfault shows that something bad is happening somewhere. I would very much like to figure out what is going on here. |
I don't get a segfault, but when in That goes the same for doing any mix, like |
I think we can close this because the "compiler" doesn't exist anymore. |
I think I have traced down the segmentation fault issue that I mentioned in the other issue.
My mix.exs looks like this with the compiler line:
If I change the :rustler atom to the end, like so:
I get strange behavior out of iex -S mix.
I've been able to replicate this with very simple code within a basic phoenix project.
Here is the strange behavior:
The initial run with iex -S mix and the calls to the code work perfectly. I get the Nif function calls within the elixir interactive environment to work just fine.
Then I close iex and reopen it.
The next time I run it, calling the elixir function that uses the rust NIF gives a segmentation fault that crashes iex.
If I edit the elixir code such that it is recompiled, I have to then run iex -S mix twice. The first gives an elixir compilation error. The next time, the elixir code compiles. Then the NIF call will work. But, close the iex and then reopen it and the segmentation fault appears.
I have been able to replicate this by switching the compiler order of :rustler to the end and to the end of the list order. I'm not sure if it's phoenix that's causing this problem or if it's just elixir.
Here's a shot of what I have under development as an example:
Then I change the order back:
For now, I'll be leaving rustler at the beginning of the list to avoid this problem.
The text was updated successfully, but these errors were encountered: