Skip to content

multinom crashes (when I do something stupid) (PR#8358)

2 messages · rob foxall (IFR), Peter Dalgaard

#
Full_Name: Rob Foxall
Version: 2.2.0
OS: Windows XP
Submission from: (NULL) (149.155.96.5)


I was using multinom from nnet package, when I did something stupid -- I entered
in an incorrect factor variable as response. This factor had only one level.
Instead of R telling me not to be so dumb, it crashed, clicking on debug coming
up with the message "An exception 'Unhandled Win32 Exception' has occurred in
Rgui.exe." This has happened on both my laptop and desktop (it took me a while
to see my mistake!). It can be easily reproduced with made-up data, e.g.

library(nnet)
set.seed(1) # not really needed, but definitely crashes for this!
temp_g <- as.factor(rep("level1",10))
temp_x <- rnorm(10)
multinom(temp_g ~ temp_x)

Cheers,
Rob.
#
rob.foxall at bbsrc.ac.uk writes:
Thanks for the reproducible example, but the general directive is to
send reports on packages directly to the package maintainer. (He'll
see it here, so don't worry about resending.)

The fault comes here:

 # weights:  3 (0 variable)
initial  value 0.000000
final  value 0.000000
converged
*** glibc detected *** free(): invalid next size (fast): 0x000000000172ce20 ***

Program received signal SIGABRT, Aborted.
0x00002aaaab059e79 in raise () from /lib64/tls/libc.so.6
(gdb) bt
#0  0x00002aaaab059e79 in raise () from /lib64/tls/libc.so.6
#1  0x00002aaaab05b48f in abort () from /lib64/tls/libc.so.6
#2  0x00002aaaab08e5d3 in __libc_message () from /lib64/tls/libc.so.6
#3  0x00002aaaab093153 in malloc_printerr () from /lib64/tls/libc.so.6
#4  0x00002aaaab0948a7 in free () from /lib64/tls/libc.so.6
#5  0x00002aaaaacb43ec in R_chk_free () from /usr/lib64/R/lib//libR.so
#6  0x00002aaaabfa3c0d in VR_unset_net ()
   from /usr/lib64/R/library/nnet/libs/nnet.so
#7  0x00002aaaaac5c3ac in do_dotCode () from /usr/lib64/R/lib//libR.so
#8  0x00002aaaaac7e712 in Rf_eval () from /usr/lib64/R/lib//libR.so
....

I.e. it is within internal C code from the nnet package, so the error
most likely belongs to the package, not R at large.