长时间在调试模式下挂起,当使用`Map`时遇到错误。

huangapple go评论58阅读模式
英文:

Long hangs in debugging mode after hitting an error when using `Map`

问题

我在进入调试模式并在执行特定 Map 调用中发生错误时遇到了非常长时间的停顿。我注意到控制台会无响应长达 15 分钟。

这个问题似乎类似于在 这里这里 报告过的情况,但提出的解决方案并没有解决它。

我注意到了一些事情:

  • “错误后挂起” 只会发生在特定的 Map 调用内 - 由于涉及大量复杂的上游代码和复杂的对象,我无法在此重现它。
  • 进入由 Map 执行的函数后立即发生挂起(即,在函数内部执行任何命令之前)。
  • 离开函数后挂起不会持续发生(即,退出调试模式),但退出调试模式也需要很长时间。

我使用的是 RStudio 2023.03.0 和 R 版本 4.2.2。

英文:

I am experiencing very long hangs every time I enter debugging mode and hit an error (of any kind) inside a function being executed in a specific Map call. I've noticed up to 15 min of an uresponsive console.

The issue seems to be similar to what has been reported here and here, but the solutions presented have not solved it.

A few things I have noticed:

  • the "hanging-after-error" only happens inside that particular Map call - which I can't reproduce here because it involves a lot of complex upstream code and complex objects.
  • the hanging happens as soon as the function being executed by Map is entered (i.e., before any commands inside the function are executed)
  • the hanging does not persist after exiting the function (i.e., exiting debugging mode), but exiting debugging mode also takes a very long time.

I'm using RStudio 2023.03.0 and R version 4.2.2

答案1

得分: 1

问题确实与解析一个非常大的调用有关(在此处报告:https://github.com/rstudio/rstudio/issues/5158#issuecomment-763320513),与do.call相关。
在我的情况下,触发原因是将非常大的list传递给Map(..., MoreArgs),我想与mapply(..., MoreArgs)一样会发生相同的情况。
我已通过将Map替换为sapply并单独传递每个参数(即使是大列表),而不是将它们分组为命名参数列表(与Map(..., MoreArgs)do.call(..., args)一样)来解决这个问题。

英文:

The issue was indeed related to parsing a very large call (reported here with respect to do.call).
In my case, it was triggered by passing a very large list to Map(..., MoreArgs) and I imagine the same would happen with mapply(..., MoreArgs).

I have solved it by replacing the Map with a sapply and passing each argument separately (even the large list), instead of grouped as a named list of arguments (as is done with Map(..., MoreArgs) and do.call(..., args)).

huangapple
  • 本文由 发表于 2023年5月11日 12:39:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76224199.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定