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

Error in (function (..., deparse.level = 1) : node stack overflow #21

Closed
DanRosauer opened this Issue Aug 24, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@DanRosauer
Copy link

DanRosauer commented Aug 24, 2017

Hi

I'm trying to set up a problem with a very large number of features (4775) in a raster stack. There are about 13400 occupied planning units.

This line:
p <- problem(pu_raster, pu_features)
Returns:
Error in (function (..., deparse.level = 1) : node stack overflow
Error during wrapup: node stack overflow

The same problem has worked fine using marxan_problem().

It's hard to debug without the data. I can zip it and place it online for download if one of the devs wants to have a look.

Or alternatively, do you know the maximum dimensions (eg features, PU or their product) which the function can handle?

thanks
Dan

@jeffreyhanson

This comment has been minimized.

Copy link
Contributor

jeffreyhanson commented Aug 24, 2017

Hi,

Thanks for posting this! Sorry for the lack of communication, I've been really busy trying to finish my thesis. I really appreciate you and @ricschuster posting bug reports here. I probably won't have time to get to this for a while, but could you run traceback () and post the output? This will tell me exactly where it's going wrong.

Thanks,

Jeff

@ricschuster

This comment has been minimized.

Copy link
Member

ricschuster commented Aug 25, 2017

Hi @DanRosauer,

Thanks for sharing this error with us. I'm nowhere close to knowing the code as well as Jeff, but if you could share your data so we can troubleshoot that would be great.

Thanks,
Richard

@DanRosauer

This comment has been minimized.

Copy link

DanRosauer commented Aug 26, 2017

Hi @ricschuster

I've just sent you a link to the data privately - sorry I couldn't do that via github.

But I can confirm that the issue relates to the size of the data / problem, because while running for all 4777 conservation features leads to this error, it ran successfully for a subset with 239 conservation features, and a correspondingly smaller number of branches and occupied planning units.

@jeffreyhanson traceback() didn't return any useful output. I will investigate further...

cheers
Dan

@ricschuster

This comment has been minimized.

Copy link
Member

ricschuster commented Aug 26, 2017

Thanks @DanRosauer. I will investigate and report back here soon.

Cheers,
Richard

@jeffreyhanson

This comment has been minimized.

Copy link
Contributor

jeffreyhanson commented Aug 27, 2017

Thanks @DanRosauer and @ricschuster!

I just had a quick google to see if I could find anything. It looks like using Matrix::cbind or Matrix::rbind in a do.call function to merge a lot of sparse matrices together can cause this issue.

One of the suggestions in that link is to replace do.call with Reduce. So maybe try changing line 101 in rij_matrix.R from

m <- do.call(rbind, m)

to

m<- Reduce(rbind, m[-1], m[[1]])

and see if that fixes it?

@DanRosauer

This comment has been minimized.

Copy link

DanRosauer commented Aug 27, 2017

Thanks @ricschuster and @jeffreyhanson

@ricschuster kindly pointed out that the problem can be set up directly from tabular data, rather than first converting it to raster. And the version from tabular data works perfectly.

So although there is a size limitation on the raster format - perhaps for the reason @jeffreyhanson noted above, the tabular option works great for my dataset.
cheers
Dan

@ricschuster

This comment has been minimized.

Copy link
Member

ricschuster commented Aug 27, 2017

Great to hear that it worked with data.frames @DanRosauer

@jeffreyhanson I've changed the code in rij_matrix.R as to your suggestion and the problem compiles now.

ricschuster added a commit that referenced this issue Aug 27, 2017

Fixed issue #21:
Error in (function (..., deparse.level = 1) : node stack overflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment