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

Run Valgrind #38

Closed
brodieG opened this issue Jun 16, 2017 · 3 comments
Closed

Run Valgrind #38

brodieG opened this issue Jun 16, 2017 · 3 comments

Comments

@brodieG
Copy link
Owner

brodieG commented Jun 16, 2017

There are gremlins lurking, including issue #36, and:

> unitize_dir()

Prepping Unitizers...                                                           
 *** caught bus error ***
address 0x7fd3cd81ad78, cause 'non-existent physical address'

Traceback:
 1: initialize(value, ...)
 2: initialize(value, ...)
 3: new("unitizerBrowseSubSectionFailed", show.out = TRUE, show.msg = TRUE,     items.new = x@items.new[x@tests.fail & sect.map], show.fail = x@tests.errorDetails[x@tests.fail &         sect.map], items.ref = x@items.ref[x@items.new.map[x@tests.fail &         sect.map]], new.conditions = x@tests.conditions.new[x@tests.fail &         sect.map], tests.result = x@tests.result[x@tests.fail &         sect.map, , drop = FALSE])
 4: .local(x, mode, ...)
 5: (function (x, mode, ...) standardGeneric("browsePrep"))(dots[[1L]][[10L]], mode = dots[[2L]][[1L]],     start.at.browser = dots[[3L]][[10L]], hist.con = 3L, interactive = TRUE)
 6: (function (x, mode, ...) standardGeneric("browsePrep"))(dots[[1L]][[10L]], mode = dots[[2L]][[1L]],     start.at.browser = dots[[3L]][[10L]], hist.con = 3L, interactive = TRUE)
 7: mapply(browsePrep, as.list(unitizers), mode = mode, start.at.browser = (identical(mode,     "review") | !to.review) & !force.update, MoreArgs = list(hist.con = hist.obj$con,     interactive = interactive.mode), SIMPLIFY = FALSE)
 8: unitize_browse(unitizers = unitizers[valid], mode = mode, interactive.mode = interactive.mode,     force.update = force.update, auto.accept = auto.accept, history = history,     global = global)
 9: doWithOneRestart(return(expr), restart)
10: withOneRestart(expr, restarts[[1L]])
11: withRestarts(unitizers[valid] <- unitize_browse(unitizers = unitizers[valid],     mode = mode, interactive.mode = interactive.mode, force.update = force.update,     auto.accept = auto.accept, history = history, global = global),     unitizerInteractiveFail = function(e) interactive.fail <<- TRUE)
12: unitize_core(test.files = test.files, store.ids = store.ids,     state = state, pre = pre, post = post, history = history,     interactive.mode = interactive.mode, force.update = force.update,     auto.accept = auto.accept, mode = "unitize")
13: unitize_dir()

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 2
Save workspace image? [y/n/c]: n

But difficult to reproduce.

@brodieG brodieG added the bug label Jun 16, 2017
@brodieG brodieG added this to the 0.1.0 milestone Jun 16, 2017
@brodieG
Copy link
Owner Author

brodieG commented Jun 27, 2017

Another:

> unitize_dir()

11/12 validate.args.R: fun5(1:2, NULL)                                          
 *** caught segfault ***
address 0xb, cause 'memory not mapped'

Traceback:
 1: `slot<-`(.Object, slotName, check = FALSE, slotVal)
 2: initialize(value, ...)
 3: initialize(value, ...)
 4: new("unitizerItemTestError", .new = item.new.dat, .ref = item.ref.dat)
 5: testItem(e1, e2)
 6: testItem(e1, e2)
 7: e1 + item
 8: e1 + item
 9: unitizer + tests
10: unitizer + tests
11: unitize_eval(tests.parsed = tests.parsed[valid], unitizers = unitizers[valid],     global = global)
12: unitize_core(test.files = test.files, store.ids = store.ids,     state = state, pre = pre, post = post, history = history,     interactive.mode = interactive.mode, force.update = force.update,     auto.accept = auto.accept, mode = "unitize")
13: unitize_dir()

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 2
Save workspace image? [y/n/c]: n

@brodieG
Copy link
Owner Author

brodieG commented Jun 28, 2017

@brodieG
Copy link
Owner Author

brodieG commented Jul 1, 2017

We're going to close this issue for now even though we're not getting perfectly clean valgrind runs. With R -d 'valgrind --dsymutil=yes --tool=memcheck', we're seeing with:

  vet(
    !anyNA(.),
    c(234234131431, 123413413413, 1341341341, 12341234134, 562456234, 24624624,
      2452345234, 2345234524, 23452452, 2243524352, 254254234, 2452452435, NA)
  )
==45756== Invalid read of size 16
==45756==    at 0x1017D7625: _platform_memchr$VARIANT$Base (in /usr/lib/system/libsystem_platform.dylib)
==45756==    by 0x111B1A78F: CSR_strmcpy (in /Library/Frameworks/R.framework/Versions/3.4/Resources/library/vetr/libs/vetr.so)
==45756==    by 0x111B234C6: VALC_process_error (in /Library/Frameworks/R.framework/Versions/3.4/Resources/library/vetr/libs/vetr.so)
==45756==    by 0x111B237B7: VALC_validate (in /Library/Frameworks/R.framework/Versions/3.4/Resources/library/vetr/libs/vetr.so)
==45756==    by 0x10011ADD4: R_doDotCall (dotcode.c:0)
==45756==    by 0x10011C6B2: do_dotcall (dotcode.c:1252)
==45756==    by 0x10014AB3C: Rf_eval (eval.c:728)
==45756==    by 0x10015AE51: R_execClosure (eval.c:1607)
==45756==    by 0x10014A9E9: Rf_eval (eval.c:747)
==45756==    by 0x10018AF47: Rf_ReplIteration (main.c:258)
==45756==    by 0x10018C43E: run_Rmainloop (main.c:308)
==45756==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==45756==  Address 0x1030d5150 is 8 bytes after a block of size 232 alloc'd
==45756==    at 0x100094671: malloc (in /usr/local/Cellar/valgrind/HEAD-16457/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==45756==    by 0x10019556D: Rf_allocVector3 (memory.c:2672)
==45756==    by 0x100142BC3: Rf_mkCharLenCE (envir.c:3884)
==45756==    by 0x100184AC1: Rf_mkString (Rinlinedfuns.h:697)
==45756==    by 0x111B1BE8D: VALC_evaluate_recurse (in /Library/Frameworks/R.framework/Versions/3.4/Resources/library/vetr/libs/vetr.so)
==45756==    by 0x111B1C066: VALC_evaluate (in /Library/Frameworks/R.framework/Versions/3.4/Resources/library/vetr/libs/vetr.so)
==45756==    by 0x111B23695: VALC_validate (in /Library/Frameworks/R.framework/Versions/3.4/Resources/library/vetr/libs/vetr.so)
==45756==    by 0x10011ADD4: R_doDotCall (dotcode.c:0)
==45756==    by 0x10011C6B2: do_dotcall (dotcode.c:1252)
==45756==    by 0x10014AB3C: Rf_eval (eval.c:728)
==45756==    by 0x10015AE51: R_execClosure (eval.c:1607)
==45756==    by 0x10014A9E9: Rf_eval (eval.c:747)
==45756== 

The best conclusion I could come up with on debugging is that the error is actually coming from CSR_strmlen_x, and in particular, from the use of memchr therein, where memchr is reading memory in blocks and as such overshoots the '\0'. Note the _platform_memchr$VARIANT$Base.

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

No branches or pull requests

1 participant