{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/devtools/issues/748","labels_url":"https://api.github.com/repos/hadley/devtools/issues/748/labels{/name}","comments_url":"https://api.github.com/repos/hadley/devtools/issues/748/comments","events_url":"https://api.github.com/repos/hadley/devtools/issues/748/events","html_url":"https://github.com/hadley/devtools/issues/748","id":64369122,"number":748,"title":"code segfaults when run after load_all()","user":{"login":"thk686","id":592841,"avatar_url":"https://avatars.githubusercontent.com/u/592841?v=3","gravatar_id":"","url":"https://api.github.com/users/thk686","html_url":"https://github.com/thk686","followers_url":"https://api.github.com/users/thk686/followers","following_url":"https://api.github.com/users/thk686/following{/other_user}","gists_url":"https://api.github.com/users/thk686/gists{/gist_id}","starred_url":"https://api.github.com/users/thk686/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thk686/subscriptions","organizations_url":"https://api.github.com/users/thk686/orgs","repos_url":"https://api.github.com/users/thk686/repos","events_url":"https://api.github.com/users/thk686/events{/privacy}","received_events_url":"https://api.github.com/users/thk686/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-25T20:48:22Z","updated_at":"2015-03-27T19:04:11Z","closed_at":null,"body":"I am developing a package with Rcpp and CXX11 mode enabled. I have test code that fails (segfaults) when calling devtools::test(), but runs perfectly fine in a normal R session. I have isolated this to a dll issue with load_all(). If I start an R session and call load_all() to load the package and then run the test code, it will segfault. If I use library(pkg) and then run the same code, no problem. This code links to a number of other dll's and the segfault occurs in an external dll. I suspect this is nothing but a dynamic linking issue. It is rather complicated to provide an example. I will provide the package on request."},"comment":{"url":"https://api.github.com/repos/hadley/devtools/issues/comments/87058926","html_url":"https://github.com/hadley/devtools/issues/748#issuecomment-87058926","issue_url":"https://api.github.com/repos/hadley/devtools/issues/748","id":87058926,"user":{"login":"thk686","id":592841,"avatar_url":"https://avatars.githubusercontent.com/u/592841?v=3","gravatar_id":"","url":"https://api.github.com/users/thk686","html_url":"https://github.com/thk686","followers_url":"https://api.github.com/users/thk686/followers","following_url":"https://api.github.com/users/thk686/following{/other_user}","gists_url":"https://api.github.com/users/thk686/gists{/gist_id}","starred_url":"https://api.github.com/users/thk686/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thk686/subscriptions","organizations_url":"https://api.github.com/users/thk686/orgs","repos_url":"https://api.github.com/users/thk686/repos","events_url":"https://api.github.com/users/thk686/events{/privacy}","received_events_url":"https://api.github.com/users/thk686/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T19:04:11Z","updated_at":"2015-03-27T19:04:11Z","body":"Here's output from a test case. First without \"load_all\" and then with \"load_all\":\r\n\r\n==8076== Memcheck, a memory error detector\r\n==8076== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.\r\n==8076== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info\r\n==8076== Command: /usr/lib/R/bin/exec/R --vanilla -f test.R\r\n==8076== \r\n\r\nR version 3.1.2 (2014-10-31) -- \"Pumpkin Helmet\"\r\nCopyright (C) 2014 The R Foundation for Statistical Computing\r\nPlatform: x86_64-pc-linux-gnu (64-bit)\r\n\r\nR is free software and comes with ABSOLUTELY NO WARRANTY.\r\nYou are welcome to redistribute it under certain conditions.\r\nType 'license()' or 'licence()' for distribution details.\r\n\r\n  Natural language support but running in an English locale\r\n\r\nR is a collaborative project with many contributors.\r\nType 'contributors()' for more information and\r\n'citation()' on how to cite R or R packages in publications.\r\n\r\nType 'demo()' for some demos, 'help()' for on-line help, or\r\n'help.start()' for an HTML browser interface to help.\r\nType 'q()' to quit R.\r\n\r\n> library(geospatial)\r\n> library(testthat)\r\n> x = georaster(100, 100, driver = \"GTiff\", nosave = TRUE)\r\n> expect_is(x, \"GeoRaster\")\r\n> SRS(x) = \"EPSG:4326\"\r\n> expect_equal(as(SRS(x), \"character\"), \"+proj=longlat +datum=WGS84 +no_defs \")\r\n> SRS(x) = SRS(\"+proj=longlat\")\r\n> expect_equal(as(SRS(x), \"character\"), \"+proj=longlat +ellps=WGS84 +no_defs \")\r\n> SRS(x) = sp::CRS(\"+proj=longlat\")\r\n> expect_equal(as(SRS(x), \"character\"), \"+proj=longlat +ellps=WGS84 +no_defs \")\r\n> \r\n==8076== \r\n==8076== HEAP SUMMARY:\r\n==8076==     in use at exit: 75,808,747 bytes in 39,381 blocks\r\n==8076==   total heap usage: 140,968 allocs, 101,587 frees, 190,212,374 bytes allocated\r\n==8076== \r\n==8076== LEAK SUMMARY:\r\n==8076==    definitely lost: 240 bytes in 5 blocks\r\n==8076==    indirectly lost: 4,755 bytes in 235 blocks\r\n==8076==      possibly lost: 0 bytes in 0 blocks\r\n==8076==    still reachable: 75,803,752 bytes in 39,141 blocks\r\n==8076==         suppressed: 0 bytes in 0 blocks\r\n==8076== Rerun with --leak-check=full to see details of leaked memory\r\n==8076== \r\n==8076== For counts of detected and suppressed errors, rerun with: -v\r\n==8076== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)\r\n\r\nUsing \"load_all\":\r\n\r\n==8127== Memcheck, a memory error detector\r\n==8127== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.\r\n==8127== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info\r\n==8127== Command: /usr/lib/R/bin/exec/R --vanilla -f test2.R\r\n==8127== \r\n\r\nR version 3.1.2 (2014-10-31) -- \"Pumpkin Helmet\"\r\nCopyright (C) 2014 The R Foundation for Statistical Computing\r\nPlatform: x86_64-pc-linux-gnu (64-bit)\r\n\r\nR is free software and comes with ABSOLUTELY NO WARRANTY.\r\nYou are welcome to redistribute it under certain conditions.\r\nType 'license()' or 'licence()' for distribution details.\r\n\r\n  Natural language support but running in an English locale\r\n\r\nR is a collaborative project with many contributors.\r\nType 'contributors()' for more information and\r\n'citation()' on how to cite R or R packages in publications.\r\n\r\nType 'demo()' for some demos, 'help()' for on-line help, or\r\n'help.start()' for an HTML browser interface to help.\r\nType 'q()' to quit R.\r\n\r\n> library(testthat)\r\n> devtools::load_all(\"~/Desktop/tkeitt/Dropbox/Software/R-Project/geospatial/\")\r\nLoading geospatial\r\n> x = georaster(100, 100, driver = \"GTiff\", nosave = TRUE)\r\n> expect_is(x, \"GeoRaster\")\r\n> SRS(x) = \"EPSG:4326\"\r\n==8127== Invalid read of size 1\r\n==8127==    at 0x12A87FC5: ??? (in /usr/lib/libgdal.so.1.18.1)\r\n==8127==    by 0x11EED375: Rcpp::S4_Impl<Rcpp::PreserveStorage> Rcpp::internal::as<Rcpp::S4_Impl<Rcpp::PreserveStorage> >(SEXPREC*, Rcpp::traits::r_type_generic_tag) [clone .isra.36] (RcppCommon.h:97)\r\n==8127==    by 0x11EEE636: geospatial_set_georaster_srs (RcppExports.cpp:191)\r\n==8127==    by 0x4EC83E1: ??? (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F07F25: Rf_eval (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F0B501: ??? (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F07E00: Rf_eval (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F0A062: ??? (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F07D3E: Rf_eval (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F09014: Rf_applyClosure (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F07ADD: Rf_eval (in /usr/lib/R/lib/libR.so)\r\n==8127==    by 0x4F0A062: ??? (in /usr/lib/R/lib/libR.so)\r\n==8127==  Address 0x4e is not stack'd, malloc'd or (recently) free'd\r\n==8127== \r\n\r\n *** caught segfault ***\r\naddress 0x4e, cause 'memory not mapped'\r\n\r\nTraceback:\r\n 1: .Call(\"geospatial_set_georaster_srs\", PACKAGE = \"geospatial\",     georas, srs)\r\n 2: set_georaster_srs(object, srs)\r\n 3: `SRS<-`(`*tmp*`, value = \"EPSG:4326\")\r\n 4: `SRS<-`(`*tmp*`, value = \"EPSG:4326\")\r\naborting ...\r\n==8127== \r\n==8127== HEAP SUMMARY:\r\n==8127==     in use at exit: 88,218,425 bytes in 45,971 blocks\r\n==8127==   total heap usage: 134,855 allocs, 88,884 frees, 213,945,830 bytes allocated\r\n==8127== \r\n==8127== LEAK SUMMARY:\r\n==8127==    definitely lost: 0 bytes in 0 blocks\r\n==8127==    indirectly lost: 0 bytes in 0 blocks\r\n==8127==      possibly lost: 5,427 bytes in 155 blocks\r\n==8127==    still reachable: 88,212,998 bytes in 45,816 blocks\r\n==8127==         suppressed: 0 bytes in 0 blocks\r\n==8127== Rerun with --leak-check=full to see details of leaked memory\r\n==8127== \r\n==8127== For counts of detected and suppressed errors, rerun with: -v\r\n==8127== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 0 from 0)\r\n\r\n"}}