【问题标题】:fread segfault with 30GB space separated file with some rows starting with spacefread segfault 具有 30GB 空格分隔的文件,其中一些行以空格开头
【发布时间】:2014-01-09 00:23:53
【问题描述】:

我之前能够成功地将 270 万乘约 3000 奇数列文件加载到 R data.table 中,但是现在我遇到了段错误。文件的大小仍然相似。不确定会发生什么。错误消息也无济于事。机器有足够的内存~256 Gb

>   dosages <- fread(combined_dosage_file, header=F, stringsAsFactors=F)

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: fread(combined_dosage_file, header = F, stringsAsFactors = F)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

会话信息()

R version 3.0.1 (2013-05-16)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] data.table_1.8.10

在具有 500K 行的较小测试文件上运行的详细输出

> f <- "../common_input/test.dosage"
> d <- fread(f, header=F, skip=1, stringsAsFactors=F, verbose=T)
Detected eol as \n only (no \r afterwards), the UNIX and Mac standard.
Using line 2 to detect sep ('skip' has been supplied) ... sep=' '
Found 3053 columns
First row with 3053 fields occurs on line 2 (either column names or first row of data)
'header' changed by user from 'auto' to FALSE
Count of eol after first data row: 500000
Subtracted 1 for last eol and any trailing empty lines, leaving 499999 data rows
Type codes: 03033222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 (first 5 rows)
Type codes: 03033222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 (+middle 5 rows)
Type codes: 03033222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 (+last 5 rows)
Bumping column 3 from INT to INT64 on data row 193249, field contains 'rs12218882'
Bumping column 3 from INT64 to REAL on data row 193249, field contains 'rs12218882'
Bumping column 3 from REAL to STR on data row 193249, field contains 'rs12218882'

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: fread(f, header = F, skip = 1, stringsAsFactors = F, verbose = T)

更新

我更仔细地查看了数据文件,结果发现一些随机行在开始时有额外的空间。删除这些后,我能够使用 60Gb RAM 在 R 中加载整个文件(与 std data.frame 相比相当惊人)。现在我很高兴,但如果这是根本原因,可能值得探索,但似乎那个空间混淆了 fread 到 diff col 大小。如果可行,它可能会吐出更具体的错误。

-阿比

【问题讨论】:

  • 太好了,感谢您的编辑!如果 30GB 文件现在可以正常加载,那么问题不在于大小,而必须是开头的那些空格,我可以相信这是一个空格分隔的文件。我已经提交了bug #5259
  • 这个问题现在在新的github项目页面上#494。我刚刚将涉及空间的修复推送到fread()。能否请您升级、测试和回写?谢谢。

标签: r data.table


【解决方案1】:

2015 年 9 月更新:根据@Arun 对上述问题的评论,他在 2015 年 9 月的 CRAN 的 v1.9.6 中修复了这个问题,#494


后人的上一个答案......

我查看了 v1.8.11 的 NEWS,但我看不到任何针对 fread 的崩溃修复。事实上,我根本不记得有任何关于 fread 的彻底崩溃报告,所以这是新的。

请将verbose=TRUE 传递给fread,看看您是否可以使用它进行复制。输出将为我提供有关崩溃位置的线索。它还将报告有关文件的信息(行、列和类型),这将很有帮助。

如果您从一个新会话开始并加载文件,它会崩溃吗?

顺便说一句,iiuc 的 RAM 将介于 30GB 和 60GB 之间,具体取决于列类型 (2.7e6 * 3000 * 4|8 / 1024^3)。一个大文件,但正如你所说,你有 256GB 的 RAM,所以是的,这绝对是 fread 应该好的。 fread 可能尚未测试到此大小。这种大小的数据集大多倾向于被分解成更小的文件,然后习惯用法是:

rbindlist(lapply(<files>, fread))

但你有你所拥有的:一个非常大的文件。所以fread 应该没问题。只是解释为什么它以前可能没有出现。

【讨论】:

  • 添加了详细的输出..我有点困惑。数据表之前在同一个数据集上运行良好,现在它给了我奇怪的错误..感谢您的快速帮助
猜你喜欢
  • 2016-03-29
  • 1970-01-01
  • 1970-01-01
  • 2014-08-02
  • 2013-04-10
  • 1970-01-01
  • 1970-01-01
  • 2014-03-12
  • 2014-11-03
相关资源
最近更新 更多