Skip to content
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

"bus error" on long running nif #443

Closed
greg-enbala opened this issue Mar 28, 2022 · 1 comment
Closed

"bus error" on long running nif #443

greg-enbala opened this issue Mar 28, 2022 · 1 comment

Comments

@greg-enbala
Copy link

greg-enbala commented Mar 28, 2022

A nif I have been running produces a "bus error" when it takes a couple seconds to complete. In some conditions it shows up as a SegFault which I believe to the same as a "bus error" but I'm not sure. The algorithm is a curve decimation algorithm that of course takes longer to complete the more points you give it and around 21600 data points it takes a couple seconds to complete and produces the "bus error". Curiously the Rust doesn't crash if compiled into just a Rust application and run directly.

Here's some example output:

$ mix test 
--Path.expand--
--File.stream--
--CSV.decode--
--to_rust--
**simplify** num_records: 21600
**collected**
**LineString**
[1]    13915 bus error  mix test

I'm not sure if this is directly a memory related issue or if it has to do with how long it takes to complete. Is there some rustler configuration I'm missing that would allow this nif to complete successfully?

I've created a self contained repo to demonstrate the issue: https://github.com/anthonyfalzetti/geo_simplify
All of the Rust code is in this one file: https://github.com/anthonyfalzetti/geo_simplify/blob/main/native/geonif/src/lib.rs

@sebastian-bellefon
Copy link

We simplified this example down to a single function. The new version is available in the same repository.

This problem appears to be caused by a stack overflow. As Issue 294 pointed out, there's not much Rustler could do to prevent this issue, so we're going to close the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants