2

I am running a script with fairly simple series of operations, converting some dates to Unix time, then adding these together.

There is no recursion here, but I am getting a

Error: C stack usage is too close to the limit

I can reproduce this, just doing the sum 1550793610 + 10. I have no idea why this is causing an error.

I am running this on a Linux server running Rstudio server. I have tried restarting R, terminating R, and setting my ulimit to unlimited. On my windows laptop I can't reproduce the error, but I can't run the whole script on my laptop so need to get it running on the server.

Just to add, I tried going 1550793610*10 and this was fine.

jay.sf
  • 60,139
  • 8
  • 53
  • 110
DinoDave
  • 33
  • 1
  • 3
  • 2
    Please add `sessionInfo()` and version of RStudio Server to your question. – jay.sf Jul 17 '23 at 08:44
  • 1
    Related post: https://stackoverflow.com/questions/14719349/error-c-stack-usage-is-too-close-to-the-limit – zx8754 Jul 17 '23 at 09:14
  • 3
    I don't believe you provide sufficient information for diagnosis. `1550793610 + 10` is one operation. I don't believe that can cause this error message on its own. – Roland Jul 17 '23 at 10:39
  • 1
    Perhaps you have loaded some non-base R packages that changed the behavior of the `+` function? In addition to `sessionInfo()`, taking a look at `conflicts(detail=TRUE)` might be helpful. Something is creating too many nested functions calls. It's impossible to say what without any sort of [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – MrFlick Jul 17 '23 at 13:55
  • I see that you solved this but for the future: there are only so many things that can happen here. In particular you are calling `+`, and later R automatically calls `print` (or `show`, depending on the result type). Consult these function definitions and ensure that they weren’t overwritten incorrectly. Also be sure to consult the method definitions if these functions are generics (which they usually are). – Konrad Rudolph Jul 18 '23 at 09:22

1 Answers1

0

Thanks for the comments all. I thought it was something creating nested function calls, but the only operation that would trigger it was any addition even 1+1. I’m familiar will all the packages I was using and there was nothing that would change the behaviour of +.

In the end I restarted R which didn’t initially solve the problem, then I rebooted the server, and then everything ran fine. So I’m marking this as solved and putting it down to a freak error!

Thanks again everyone for your comments.

DinoDave
  • 33
  • 1
  • 3