[Rd] reproducible segmentation fault caused by textConnection()

Sklyar, Oleg (MI London) osklyar at maninvestments.com
Tue Apr 29 16:07:38 CEST 2008


Hi Tony, Greg.

I get the same as Greg's: segfault

*** R version 2.7.0 (2008-04-22) [/research/osklyar/R-2.7.0] ***
> sessionInfo()
R version 2.7.0 (2008-04-22)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_GB;LC_NUMERIC=C;LC_TIME=en_GB;LC_COLLATE=C;LC_MONETARY=C;LC_
MESSAGES=en_GB;LC_PAPER=en_GB;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_M
EASUREMENT=en_GB;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
> for (i in 1:10000) {
+
+    z=textConnection(NULL,open='w')
+
+    for (j in 1:100) {
+
+      write(runif(1)*1e6,file=z)
+
+      write('\n',file=z)
+
+    }
+
+    close(z)
+
+ }

 *** caught segfault ***
address 0xa0b0, cause 'memory not mapped'

Traceback:
 1: cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1), "\n"),
append = append)
 2: write(runif(1) * 1e+06, file = z)

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:

Dr Oleg Sklyar
Technology Group
Man Investments Ltd
+44 (0)20 7144 3803
osklyar at maninvestments.com 

> -----Original Message-----
> From: r-devel-bounces at r-project.org 
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Tony Chiang
> Sent: 29 April 2008 15:02
> To: Gregoire Pau
> Cc: r-devel at r-project.org
> Subject: Re: [Rd] reproducible segmentation fault caused by 
> textConnection()
> 
> Hi Greg,
> 
> I get a different error on my mac:
> 
> > for (i in 1:10000) {
> +  try({z=textConnection(NULL,open='w')
> +  for (j in 1:100) {
> +    write(runif(1)*1e6,file=z)
> +    write('\n',file=z)
> +  }
> +  close(z)})
> + }
> Error : cannot set length of non-vector
> In addition: Warning message:
> closing unused connection 3 (NULL)
> Error: no function to return from, jumping to top level In 
> addition: Warning message:
> closing unused connection 3 (NULL)
> Error : Value of SET_STRING_ELT() must be a 'CHARSXP' not a 
> 'character'
> Error : cannot set length of non-vector
> Error : cannot set length of non-vector
> Error : cannot set length of non-vector
> Error: no function to return from, jumping to top level In 
> addition: Warning messages:
> 1: closing unused connection 7 (NULL)
> 2: closing unused connection 6 (NULL)
> 3: closing unused connection 5 (NULL)
> 4: closing unused connection 4 (NULL)
> Error : cannot set length of non-vector
> Error : cannot set length of non-vector
> In addition: Warning message:
> closing unused connection 5 (NULL)
> Error: no function to return from, jumping to top level In 
> addition: Warning message:
> closing unused connection 5 (NULL)
> Error : SET_STRING_ELT() can only be applied to a 'character 
> vector', not a 'integer'
> Error: no function to return from, jumping to top level In 
> addition: Warning message:
> closing unused connection 6 (NULL)
> Error : cannot set length of non-vector
> Error : Value of SET_STRING_ELT() must be a 'CHARSXP' not a 
> 'character'
> In addition: Warning message:
> closing unused connection 7 (NULL)
> Error : cannot set length of non-vector
> 
> whence I ^C out of the loop.
> 
> > sessionInfo()
> R version 2.7.0 Patched (2008-04-28 r45540)
> i386-apple-darwin8.10.1
> 
> locale:
> C
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> On Tue, Apr 29, 2008 at 2:52 PM, Gregoire Pau <gpau at ebi.ac.uk> wrote:
> 
> > Dear all,
> >
> > It seems that textConnection() can trigger a segmentation 
> fault. The 
> > following script (using two large loops) makes this bug 
> reproducible:
> >
> > for (i in 1:10000) {
> >  z=textConnection(NULL,open='w')
> >  for (j in 1:100) {
> >    write(runif(1)*1e6,file=z)
> >    write('\n',file=z)
> >  }
> >  close(z)
> > }
> >
> > The bug could be reproduced on R-2.6.1, R-2.7.0 and on the latest 
> > R-devel
> > 2008-04-29 r45543.
> > Here are some sessionInfo() details:
> > *----*
> > R version 2.6.1 (2007-11-26)
> > x86_64-unknown-linux-gnu
> >
> > locale:
> >
> > 
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US
> > 
> .UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.
> > 
> UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8
> > ;LC_IDENTIFICATION=C
> >
> > attached base packages:
> > [1] stats     graphics  grDevices utils     datasets  methods   base
> > *----*
> > R version 2.7.0 (2008-04-22)
> > x86_64-unknown-linux-gnu
> >
> > locale:
> >
> > 
> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB
> > 
> .UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_N
> > 
> AME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTI
> > FICATION=C
> >
> > attached base packages:
> > [1] stats     graphics  grDevices datasets  utils     methods   base
> > *----*
> > R version 2.8.0 Under development (unstable) (2008-04-29 r45543) 
> > x86_64-unknown-linux-gnu
> >
> > locale:
> >
> > 
> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB
> > 
> .UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_N
> > 
> AME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTI
> > FICATION=C
> >
> > attached base packages:
> > [1] stats     graphics  grDevices datasets  utils     methods   base
> >
> > Greg
> > ---
> > Gregoire Pau
> > EMBL/EBI Cambridge, UK
> > http://www.ebi.ac.uk/~gpau <http://www.ebi.ac.uk/%7Egpau>
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 


**********************************************************************
The contents of this email are for the named addressee(s...{{dropped:22}}



More information about the R-devel mailing list