Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*** caught segfault *** address (nil), cause 'memory not mapped' #6

Closed
fhsantanna opened this issue Jan 24, 2023 · 9 comments
Closed

Comments

@fhsantanna
Copy link

Hi.

Very nice tool!

When I try to run a data frame having a dimension of 1729 × 36, I get the following error:


> myout <- affinity(data = banco_menor, row.or.col = "column", squarematrix = c("all"))

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
 1: pFNCHypergeo(x, mA, N - mA, mB, exp(alp))
 2: pFNCH(-10)
 3: doTryCatch(return(expr), name, parentenv, handler)
 4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 5: tryCatchList(expr, classes, parentenv, handlers)
 6: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
 7: try(pFNCH(-10), silent = T)
 8: minmaxAlpha.pFNCH(x, marg)
 9: EHypQuInt(x, marg, (1 + lev)/2)
10: AlphInts(x, marg, lev = lev, scal = scal, pvalType = pvalType)
11: ML.Alpha(x = X, marg = c(sum(mA), sum(mB), nrow(sub)))
12: affinity(data = banco_menor, row.or.col = "column", squarematrix = c("all"))
13: eval(expr, envir, enclos)
14: eval(expr, envir, enclos)
15: eval_with_user_handlers(expr, envir, enclos, user_handlers)
16: withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers))
17: withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = eHandler,     message = mHandler)
18: doTryCatch(return(expr), name, parentenv, handler)
19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
20: tryCatchList(expr, classes, parentenv, handlers)
21: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
22: try(f, silent = TRUE)
23: handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = eHandler,     message = mHandler))
24: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = eHandler,     message = mHandler)))
25: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,     debug = debug, last = i == length(out), use_try = stop_on_error !=         2L, keep_warning = keep_warning, keep_message = keep_message,     output_handler = output_handler, include_timing = include_timing)
26: evaluate(request$content$code, envir = .GlobalEnv, output_handler = oh,     stop_on_error = 1L)
27: doTryCatch(return(expr), name, parentenv, handler)
28: tryCatchOne(expr, names, parentenv, handlers[[1L]])
29: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
30: doTryCatch(return(expr), name, parentenv, handler)
31: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
32: tryCatchList(expr, classes, parentenv, handlers)
33: tryCatch(evaluate(request$content$code, envir = .GlobalEnv, output_handler = oh,     stop_on_error = 1L), interrupt = function(cond) {    log_debug("Interrupt during execution")    interrupted <<- TRUE}, error = .self$handle_error)
34: executor$execute(msg)
35: handle_shell()
36: kernel$run()
37: IRkernel::main()
An irrecoverable exception occurred. R is aborting now ...

I can run the function if I reduce the data frame to 1729 × 5. I am running the analysis on a Xeon with 64 Gb of RAM.
Any idea on how to avoid this issue?

@kpmainali
Copy link
Owner

What is your data size? Does this happen on the same row if you rerun the script? Can you provide the argument values that caused the script to memory map failure?

@fhsantanna
Copy link
Author

My file has 3 Mb, a dataframe with dimension 1729 × 36.
Yes, it fails at the command below (arguments are the same as the tutorial):

> myout <- affinity(data = banco_menor, row.or.col = "column", squarematrix = c("all"))

@fhsantanna
Copy link
Author

I have I hint, the size of the table was not the problem.
I detected three columns that crashed the script.
Please try to run "affinity" using the following dataframe: file download

@kpmainali
Copy link
Owner

kpmainali commented Jan 26, 2023

I was able to run the script on your data without problem. I have R 4.1.3 GUI 1.77 High Sierra build (8051) in a Mac. I tested this both in R and RStudio.

Looking at the output of your error, it seems your 'memory not mapped' problem has something to do with interaction with another package. https://stackoverflow.com/questions/49190251/caught-segfault-memory-not-mapped-error-in-r

Can you test this script in a new environment without loading other packages?

> myout <- affinity(data = banco_menor, row.or.col = "col", squarematrix = c("all"))
[1] "------------ as expected, the data ready for analysis has only 1 and 0... 1 = present, 0 = absent used for the interpretation"
~~~~~~~~~~ printing head of all elements of the output list ~~~~~~~~~~

@fhsantanna
Copy link
Author

fhsantanna commented Jan 27, 2023

My system is Linux Mint 20.1.
I compiled CooccurrenceAffinity under R 4.1.3 (devtools 2.4.2 and gmp 0.6-5) and it still crashes. I only loaded CooccurrenceAffinity library.

I believe the problem is on the compilation of CooccurrenceAffinity, but I have no clue how to solve this.

@kpmainali
Copy link
Owner

I was able to pinpoint the source of the problem. It is the updated BiasedUrn package that is failing the script. I was able to run affinity() on your data without any problem as I indicated earlier. Then I updated BiasedUrn from 1.07 -> 2.0.8 and it started crashing. I am working with my collaborator to resolve it within our package. Allow me a few days.

@kpmainali
Copy link
Owner

Please see the Readme for a temporary solution of this problem. Can you check if this resolves your problem?

@fhsantanna
Copy link
Author

Yes, it solved the problem! Thank you very much!

@kpmainali
Copy link
Owner

Hi @fhsantanna please see our readme for the permanent solution to the problem you reported earlier. I have copied the notice below. And, thanks for bringing this issue to us.

"Feb 6, 2023: We are pleased to inform you that the interaction issue between our package and BiasedUrn v2.0.8 has been resolved in the latest version, BiasedUrn v2.0.9. We kindly request that you remove any previous versions of BiasedUrn and install v2.0.9 to ensure proper operation of the CooccurrenceAffinity package. We extend our heartfelt thanks to Agner Fox for promptly updating BiasedUrn and addressing these important issues."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants