[Rd] Using response variable in interaction as explanatory variable in glm crashes R

2017-10-06 Thread Jan van der Laan


The following code crashes R (I know I shouldn't try to estimate such a 
model; this was a bug in some code of mine). I also tried with R-devel; 
same result.



tab <- structure(list(dob_day = c(FALSE, FALSE, FALSE, FALSE, TRUE,
TRUE, TRUE, TRUE), dob_mon = c(FALSE, FALSE, TRUE, TRUE, FALSE,
FALSE, TRUE, TRUE), dob_year = c(FALSE, TRUE, FALSE, TRUE, FALSE,
TRUE, FALSE, TRUE), n = c(1489634L, 17491L, 134985L, 1639L, 47892L,
611L, 4365L, 750L), pred1 = c(1488301, 18187, 135605, 1657, 48547,
593, 4423, 54)), .Names = c("dob_day", "dob_mon", "dob_year",
"n", "pred1"), row.names = c(NA, -8L), class = "data.frame")

m <- glm(dob_mon ~ dob_day*dob_mon, data = tab, family = binomial())


The crash doesn't when the variables are added just as main effects 
(dob_day+dob_mon): this results in a warning and the removal of dob_mon 
from the formula.


--

Jan



> R.version
   _
platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  3
minor  4.1
year   2017
month  06
day    30
svn rev    72865
language   R
version.string R version 3.4.1 (2017-06-30)
nickname   Single Candle

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Using response variable in interaction as explanatory variable in glm crashes R

2017-10-06 Thread Jan van der Laan
It is actually model.matrix that crashes, not glm. Same crash occurs 
with e.g. lm.


model.matrix(dob_mon ~ dob_day*dob_mon, data = tab)

also crashes R.

Jan



On 06-10-17 12:08, Jan van der Laan wrote:


The following code crashes R (I know I shouldn't try to estimate such 
a model; this was a bug in some code of mine). I also tried with 
R-devel; same result.



tab <- structure(list(dob_day = c(FALSE, FALSE, FALSE, FALSE, TRUE,
TRUE, TRUE, TRUE), dob_mon = c(FALSE, FALSE, TRUE, TRUE, FALSE,
FALSE, TRUE, TRUE), dob_year = c(FALSE, TRUE, FALSE, TRUE, FALSE,
TRUE, FALSE, TRUE), n = c(1489634L, 17491L, 134985L, 1639L, 47892L,
611L, 4365L, 750L), pred1 = c(1488301, 18187, 135605, 1657, 48547,
593, 4423, 54)), .Names = c("dob_day", "dob_mon", "dob_year",
"n", "pred1"), row.names = c(NA, -8L), class = "data.frame")

m <- glm(dob_mon ~ dob_day*dob_mon, data = tab, family = binomial())


The crash doesn't when the variables are added just as main effects 
(dob_day+dob_mon): this results in a warning and the removal of 
dob_mon from the formula.


--

Jan



> R.version
   _
platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  3
minor  4.1
year   2017
month  06
day    30
svn rev    72865
language   R
version.string R version 3.4.1 (2017-06-30)
nickname   Single Candle

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] SIGSEGV during startup

2017-10-06 Thread Joshua Ulrich
Hi,

This problem started as of r73472 ("Merged in the rest of the basic
ALTREP framework."); I tested r73471 and it did not exist.

I'm building R devel on Ubuntu 16.04.3 LTS (64-bit), with the following flags:
  CC="gcc -std=gnu99 -fsanitize=address -fno-omit-frame-pointer"
  CFLAGS="-fno-omit-frame-pointer -g -O2 -Wall -pedantic -mtune=native"
and using
  configure --with-valgrind-instrumentation=2

Running 'make' builds the R binary, but R fails to start.  So 'make'
ultimately fails when trying to install sysdata.rda during the tools
package build.  Here is the traceback:

make[5]: Leaving directory '/home/josh/R/R-build/src/library/tools/src'
make[4]: Leaving directory '/home/josh/R/R-build/src/library/tools'
make[4]: Entering directory '/home/josh/R/R-build/src/library/tools'
installing 'sysdata.rda'
ASAN:SIGSEGV
=
==3543==ERROR: AddressSanitizer: SEGV on unknown address
0x (pc 0x0043b2f2 bp 0x7ffeb5fdc670 sp 0x7ffeb5fdc660
T0)
#0 0x43b2f1 in ALTVEC_DATAPTR ../../../R-svn/src/main/altrep.c:305
#1 0x6b1068 in DATAPTR ../../../R-svn/src/include/Rinlinedfuns.h:105
#2 0x6b1068 in GetNewPage ../../../R-svn/src/main/memory.c:908
#3 0x6b5284 in Rf_allocVector3 ../../../R-svn/src/main/memory.c:2514
#4 0x654a49 in Rf_allocVector ../../../R-svn/src/include/Rinlinedfuns.h:514
#5 0x654a49 in Rf_mkTrue ../../../R-svn/src/main/gram.c:4164
#6 0x6b616c in Rf_InitMemory ../../../R-svn/src/main/memory.c:2137
#7 0x69186a in setup_Rmainloop ../../../R-svn/src/main/main.c:842
#8 0x694488 in Rf_mainloop ../../../R-svn/src/main/main.c:1088
#9 0x41e398 in main ../../../R-svn/src/main/Rmain.c:29
#10 0x7f9d71f4182f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#11 0x41fbe8 in _start (/home/josh/R/R-build/bin/exec/R+0x41fbe8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../../../R-svn/src/main/altrep.c:305
ALTVEC_DATAPTR
==3543==ABORTING
../../../../R-svn/share/make/basepkg.mk:150: recipe for target 'sysdata' failed
make[4]: *** [sysdata] Error 1
make[4]: Leaving directory '/home/josh/R/R-build/src/library/tools'
Makefile:30: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/josh/R/R-build/src/library/tools'
Makefile:36: recipe for target 'R' failed
make[2]: *** [R] Error 1
make[2]: Leaving directory '/home/josh/R/R-build/src/library'
Makefile:28: recipe for target 'R' failed
make[1]: *** [R] Error 1
make[1]: Leaving directory '/home/josh/R/R-build/src'
Makefile:60: recipe for target 'R' failed
make: *** [R] Error 1

The context around memory.c:908 is below, and suggests the issue
manifests with the combination of the ALTREP framework and valgrind
instrumentation level >1.

#if  VALGRIND_LEVEL > 1
if (NodeClassSize[node_class] > 0)
VALGRIND_MAKE_MEM_NOACCESS(DATAPTR(s),
NodeClassSize[node_class]*sizeof(VECREC));
#endif


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] SIGSEGV during startup

2017-10-06 Thread luke-tierney

Thanks -- should be resolved now.

Best,

luke

On Fri, 6 Oct 2017, Joshua Ulrich wrote:


Hi,

This problem started as of r73472 ("Merged in the rest of the basic
ALTREP framework."); I tested r73471 and it did not exist.

I'm building R devel on Ubuntu 16.04.3 LTS (64-bit), with the following flags:
 CC="gcc -std=gnu99 -fsanitize=address -fno-omit-frame-pointer"
 CFLAGS="-fno-omit-frame-pointer -g -O2 -Wall -pedantic -mtune=native"
and using
 configure --with-valgrind-instrumentation=2

Running 'make' builds the R binary, but R fails to start.  So 'make'
ultimately fails when trying to install sysdata.rda during the tools
package build.  Here is the traceback:

make[5]: Leaving directory '/home/josh/R/R-build/src/library/tools/src'
make[4]: Leaving directory '/home/josh/R/R-build/src/library/tools'
make[4]: Entering directory '/home/josh/R/R-build/src/library/tools'
installing 'sysdata.rda'
ASAN:SIGSEGV
=
==3543==ERROR: AddressSanitizer: SEGV on unknown address
0x (pc 0x0043b2f2 bp 0x7ffeb5fdc670 sp 0x7ffeb5fdc660
T0)
   #0 0x43b2f1 in ALTVEC_DATAPTR ../../../R-svn/src/main/altrep.c:305
   #1 0x6b1068 in DATAPTR ../../../R-svn/src/include/Rinlinedfuns.h:105
   #2 0x6b1068 in GetNewPage ../../../R-svn/src/main/memory.c:908
   #3 0x6b5284 in Rf_allocVector3 ../../../R-svn/src/main/memory.c:2514
   #4 0x654a49 in Rf_allocVector ../../../R-svn/src/include/Rinlinedfuns.h:514
   #5 0x654a49 in Rf_mkTrue ../../../R-svn/src/main/gram.c:4164
   #6 0x6b616c in Rf_InitMemory ../../../R-svn/src/main/memory.c:2137
   #7 0x69186a in setup_Rmainloop ../../../R-svn/src/main/main.c:842
   #8 0x694488 in Rf_mainloop ../../../R-svn/src/main/main.c:1088
   #9 0x41e398 in main ../../../R-svn/src/main/Rmain.c:29
   #10 0x7f9d71f4182f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
   #11 0x41fbe8 in _start (/home/josh/R/R-build/bin/exec/R+0x41fbe8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../../../R-svn/src/main/altrep.c:305
ALTVEC_DATAPTR
==3543==ABORTING
../../../../R-svn/share/make/basepkg.mk:150: recipe for target 'sysdata' failed
make[4]: *** [sysdata] Error 1
make[4]: Leaving directory '/home/josh/R/R-build/src/library/tools'
Makefile:30: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/josh/R/R-build/src/library/tools'
Makefile:36: recipe for target 'R' failed
make[2]: *** [R] Error 1
make[2]: Leaving directory '/home/josh/R/R-build/src/library'
Makefile:28: recipe for target 'R' failed
make[1]: *** [R] Error 1
make[1]: Leaving directory '/home/josh/R/R-build/src'
Makefile:60: recipe for target 'R' failed
make: *** [R] Error 1

The context around memory.c:908 is below, and suggests the issue
manifests with the combination of the ALTREP framework and valgrind
instrumentation level >1.

#if  VALGRIND_LEVEL > 1
if (NodeClassSize[node_class] > 0)
   VALGRIND_MAKE_MEM_NOACCESS(DATAPTR(s),
NodeClassSize[node_class]*sizeof(VECREC));
#endif





--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel