views:

77

answers:

1

I am using R 2.11.1 and XML package 3.1-0, and I was going through an example from R2GoogleMaps when I encountered a segfault error.

#library(RJSONIO)
library(R2GoogleMaps)
library(XML)
#library(RCurl)

load("b.rda") # find in the sampleDocs folder in source file of R2GoogleMaps

center = c(mean(range(b$lat)), mean(range(b$long)))
code = addOverlay(gpolyline(b))

d = googleMapsDoc(code, center, zoom = 11, dim = c(750, 700), file = "simplePolyline.html")

Below is an easily reproducible code that gets the same error:

> library(XML)
> a <- htmlParse("http://bm2.genes.nig.ac.jp/RGM2/R_current/library/XML/man/xmlTreeParse.html")
> a

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

Traceback:
 1: .Call("RS_XML_dumpHTMLDoc", doc, as.integer(indent), as.character(encoding),     as.logical(indent), PACKAGE = "XML")
 2: saveXML(from)
 3: saveXML(from)
 4: asMethod(object)
 5: as(x, "character")
 6: cat(as(x, "character"), "\n")
 7: print.XMLInternalDocument(<pointer: 0x1016363f0>)
 8: print(<pointer: 0x1016363f0>)

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: 1
aborting ...

Process R segmentation fault at Sat Jul 31 22:07:02 2010

The problem also seems to be doing a saveXML() on the htmlParse() file.

When I was writing up another code that used htmlParse(), I don't recall ever encountering this problem (although I don't remember if I called a htmlParse() object explicitly). So I'm not entirely sure if this is a recent problem or not. The only difference between then and now (that I can remember) is that I've installed many of the OmegaHat packages from source.

I was curious if anyone else was getting this error. To explore if the cause lies with my laptop, I have restarted and upgraded my OS as a basic step. What might be the problem? Thanks.

edit: just for ref:

> sessionInfo()
R version 2.11.1 (2010-05-31) 
x86_64-apple-darwin9.8.0 

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  grid      methods  
[8] base     

other attached packages:
[1] XML_3.1-0     digest_0.4.2  reshape_0.8.3 plyr_0.1.9    proto_0.3-8  

loaded via a namespace (and not attached):
[1] ggplot2_0.8.7
+1  A: 

I think that almost by definition a segmentation fault constitutes a bug. Your example works for me (see below).

I would (a) make sure you have the latest version of XML and that the error still occurs there; (b) contact the maintainer of the XML package (try

maintainer("XML") ) and provide your example and the results of sessionInfo()

good luck.

=============

library(XML) a <- htmlParse("http://bm2.genes.nig.ac.jp/RGM2/R_current/library/XML/man/xmlTreeParse.html")

sessionInfo() R version 2.11.1 (2010-05-31) i486-pc-linux-gnu

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets grid methods
[8] base

other attached packages: [1] XML_3.1-0 reshape_0.8.3 plyr_1.0.3 proto_0.3-8

loaded via a namespace (and not attached): [1] ggplot2_0.8.8

Ben Bolker
Oops, I see that you did specify your version of XML (which seems tobe the latest)
Ben Bolker
Thank you Ben. Contacting the package creators is probably the best bet.
apeescape
reinstalled from source and now it works.
apeescape