R ffdfappend SIGBUS错误

时间:2014-09-18 10:55:02

标签: r bus-error ff ffbase sigbus

我有一个使用ffbaseff包的R脚本。在Windows中,脚本运行正常。在Linux(不同的盒子,更高的RAM)中,它会因总线(SIGBUS)错误而崩溃。

Windows(版本6.1.7601)会话信息:

  1. R版本3.1.0(2014-04-10)
  2. 平台:x86_64-w64-mingw32 / x64(64位)
  3. 附件包:ffbase_0.11.3 ff_2.2-13 bit_1.1-12
  4. Linux(Linux xenja 3.5.0-54-generic#81~minision1-Ubuntu SMP Tue 7月15日04:02:22 UTC 2014 x86_64 x86_64 x86_64 GNU / Linux)会话信息:

    1. R版本3.1.1(2014-07-10)
    2. 平台:x86_64-pc-linux-gnu(64位)
    3. 附件包:ffbase_0.11.3 ff_2.2-13 bit_1.1-12
    4. R脚本崩溃的位置位于循环内,循环重复读取不同的文件内容,并通过ff函数在ffdfappend数据框中连接它们。循环如下:

      working_dir<-getwd()
      for(clan_i in levels(data$clan_id)){
        curr_run_name<-paste('clan_',clan_i,sep='')
        curr_working_dir<-paste(working_dir,curr_run_name,sep='/')
        setwd(curr_working_dir)
        prinsout_score_files<-list.files(pattern="^score_.*\\.ent\\.gz\\.txt$")
        clan_i_scores<-c()
        for(prinsout_score_file_i in prinsout_score_files){
          prinsout_score_i<-read.table(prinsout_score_file_i,header=T, row.names=NULL, stringsAsFactors=F)
          if(nrow(prinsout_score_i) > 0){
            prinsout_score_i$pdb_id<-gsub('.*pdb([^\\.]+).*','\\1',prinsout_score_file_i)
            prinsout_score_i$aa<-factor(prinsout_score_i$aa)
            prinsout_score_i$chain<-factor(prinsout_score_i$chain)
            clan_i_scores<-rbind(clan_i_scores,prinsout_score_i[,!grepl('Neighbors',colnames(prinsout_score_i))])
          }
        }
        if(!is.null(clan_i_scores)){
          clan_i_scores$clan_id<-clan_i
          chr_cols<-attr(which(lapply(clan_i_scores, class) == 'character'), 'names')
          clan_i_scores[,chr_cols]<-lapply(clan_i_scores[,chr_cols], factor)
        }
        if(is.null(clans_scores)){
          if(!is.null(clan_i_scores)){
            clans_scores<-as.ffdf(rbind(clans_scores, clan_i_scores))
          }
        }else{
          if(!is.null(clan_i_scores)){
            clans_scores<-ffdfappend(clans_scores, clan_i_scores)
          }
        }
        setwd(working_dir)
      }
      

      当我在Linux中运行R脚本时,在标准错误中写入以下内容(我故意用 @@@ 截断非常长的行)

          *** caught bus error ***
      address 0x7f68c7172000, cause 'non-existent physical address'
      Traceback:
      1: `[<-.ff`(`*tmp*`, , value = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L @@@
      2: `[<-`(`*tmp*`, , value = c(1L, 1L, 1L, 1L, @@@
      3: update.ff(ret, from = initdata, delete = FALSE, bydim = bydim, @@@
      4: ff(initdata = initdata, length = length, levels = levels, @@@
      5: assign("ret", ff(initdata = initdata, length = length, levels = levels, @@@
      6: clone.ff(x, FF_RETURN = TRUE, filename = filename, overwrite = overwrite,     ...)
      7: as.ff.default(c(1L, 1L, 1L, @@@
      8: as.ff(c(1L, 1L, 1L, @@@ 
      9: do.call("as.ff", c(list(xi, vmode = vmodes[[i]]), col_args))
      10: FUN(1:12[[10L]], ...)
      11: lapply(seq_along(x), function(i, ...) {xi <- x[[i]]    AsIs <- inherits(xi, "AsIs")    if (AsIs) {        oldClass(xi) <- oldClass(xi)[-match("AsIs", oldClass(xi))]        ret <- do.call("as.ff", c(list(xi, vmode = vmodes[[i]]), col_args))        oldClass(ret) <- c("AsIs", oldClass(ret))        ret    }    else { do.call("as.ff", c(list(xi, vmode = vmodes[[i]]), col_args))    }}, ...)
      12: as.ffdf.data.frame(dat)
      13: as.ffdf(dat)
      14: ffdfappend(clans_scores, clan_i_scores)
      15: eval(expr, envir, enclos)
      16: eval(ei, envir)
      17: withVisible(eval(ei, envir))
      18: source("shinyprins.R")
      

      当我将R脚本附加到gdb时,我会在崩溃时收到以下相关消息:

      Program received signal SIGBUS, Bus error.
      ff_integer_set (handle=<optimized out>, index=<optimized out>, x=1) at ff.cpp:341
      341     ff.cpp: No such file or directory.
      

      gdb backtrace:

      0:  ff_integer_set (handle=<optimized out>, index=<optimized out>, x=1) at ff.cpp:341
      1:  0x00007f8fd4a07a77 in r_ff_integer_set_vector (ff_=0x69fb748, index_=0x1027d7, nreturn_=<optimized out>, value_=<optimized out>)
      at r_ff_addgetset.h:535
      2:  0x00007f8fda12b228 in ?? () from /usr/lib/R/lib/libR.so
      3:  0x00007f8fda15e2d9 in ?? () from /usr/lib/R/lib/libR.so
      4:  0x00007f8fda169f70 in ?? () from /usr/lib/R/lib/libR.so
      5:  0x00007f8fda16f49d in Rf_applyClosure () from /usr/lib/R/lib/libR.so
      @@@
      91: 0x00007f8fda16f49d in Rf_applyClosure () from /usr/lib/R/lib/libR.so
      92: 0x00007f8fda164e5f in ?? () from /usr/lib/R/lib/libR.so
      93: 0x00007f8fda169f70 in ?? () from /usr/lib/R/lib/libR.so
      94: 0x00007f8fda16f49d in Rf_applyClosure () from /usr/lib/R/lib/libR.so
      95: 0x00007f8fda16a066 in ?? () from /usr/lib/R/lib/libR.so
      96: 0x00007f8fda1937fa in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
      97: 0x00007f8fda193b30 in ?? () from /usr/lib/R/lib/libR.so
      98: 0x00007f8fda194054 in run_Rmainloop () from /usr/lib/R/lib/libR.so
      99: 0x000000000040074b in main ()
      100: 0x00007f8fd9ad976d in __libc_start_main (main=0x400730 <main>, argc=1, ubp_av=0x7fff0a0799d8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff0a0799c8) at libc-start.c:226
      101: 0x000000000040077d in _start ()
      

      当我使用strace运行R脚本时,我会在崩溃时获得以下相关信息:

      open("/tmp/Rtmpznhr7X/ffdf79f87c5de24b.ff", O_RDWR) = 31
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x10000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x20000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x30000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x40000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x50000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x60000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x70000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x80000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x90000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0xa0000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0xb0000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0xc0000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0xd0000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0xe0000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0xf0000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x100000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x110000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x120000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x130000) = 0x7ff558d88000
      munmap(0x7ff558d88000, 65536)           = 0
      mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 31, 0x140000) = 0x7ff558d88000
      --- SIGBUS (Bus error) @ 0 (0) ---
      write(2, "\n *** caught bus error ***\n", 27) = 27
      write(2, "address 0x7ff558d92000, cause 'n"..., 62) = 62
      write(2, "\nTraceback:\n", 12)          = 12
      write(2, " 1: ", 4)                     = 4
      write(2, "`[<-.ff`(`*tmp*`, , value = c(1L"..., 62) = 62
      

      关于如何继续欣赏的任何建议。

      非常感谢你的时间。

      -George。

0 个答案:

没有答案