微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Ubuntu 16.04 上的 R DotNet 分段错误

如何解决Ubuntu 16.04 上的 R DotNet 分段错误

我无法弄清楚为什么我的 R 调用突然失败并出现分段错误(核心转储)错误。我已经将其追溯到 R.DotNet 中的 TryEvaluate 调用: IntPtr 指针 = this.GetFunction()(handle,environment.DangerousGetHandle(),out errorOccurred);

不幸的是,这不是我创建的代码,我对 R 的工作原理知之甚少,我只是一直在维护它。

我使用的是 Ubuntu 16.04,我尝试安装几个不同版本的 R 来查看 R(4.0、3.6、3.4)是否有问题 可能不是很有帮助,但是失败时正在执行的语句是: post(Tree,file="output/Error2withQChanges_noprune.ps"

任何想法如何找出导致分段错误的原因?我不是每次都收到错误,但似乎某些数据集导致它发生。

这是我用于 Ubuntu 容器的 dockerfile:

FROM ubuntu:16.04

#install R
#I took the same steps as installing R on ubuntu from here: https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-16-04-2
# We apparently have to install the libgdiplus library. Without it I was getting an error in R where it said it Couldn't find the shared library libdl
# The closest I Could find was: https://github.com/VahidN/EPPlus.Core/issues/40#issuecomment-370366985 
# installing that fixed the library not found issues

RUN apt-get update \
    && apt-get install -y software-properties-common \
    && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
    && add-apt-repository 'deb http://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/' \
    && apt-get update \
    && apt-get install -y r-base --no-install-recommends \
    && apt-get install -y --no-install-recommends libgdiplus libc6-dev \
    && rm -rf /var/lib/apt/lists/*

#copy in client folder
copY clientfolder /clientfolder

#explicitly set R_Home variable
ENV R_HOME /usr/lib/R

以下是在失败之前运行的 R 命令:

library(rpart)
Tree <- rpart(Pass ~ <a bunch of columns in my dataset separated by +>,data=ErrorData,minsplit=1,minbucket=1,method='class')
gc()
PrunedTree <- prune(Tree,cp=Tree$cptable[which.min(Tree$cptable[,"xerror"]),"CP"])
ErrorData["leafid"] <- PrunedTree$where
post(Tree,file="/output/Error2withQChanges_noprune.ps")
post(PrunedTree,file="/output/Error2withQChanges.ps")
gc()

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。