xml_add_parent produces a segfault in for loop
还没有人认领这个 Issue。
- #396 来自 @alexverse —— 已关闭,未合并
评估
调研方向
Start by running the supplied minimal R loop with xml2 1.3.2 and inspect the xml_add_parent entry point and its interaction with repeated calls. Done means the stress loop completes without a segfault while preserving the shown parent-child XML structure, with a regression test covering the reproduction.
由索引模型根据 Issue 内容生成。
描述
By developing a plumber API with xml2 I fall into the following error under a small stress test. I reproduce a minimal example in my local machine.
The following code chunk produces an error,
library(xml2)
xx <- function() {
x <- read_xml("<fruits><apple color='red'></apple></fruits>")
xml_add_parent(x, read_xml("<food></food>"))
print(as.character(x))
}
for(i in 1:1000)xx()
[1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<food>\n <fruits>\n <apple color=\"red\"/>\n </fruits>\n</food>\n"
[1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<food>\n <fruits>\n <apple color=\"red\"/>\n </fruits>\n</food>\n"
[1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<food>\n <fruits>\n <apple color=\"red\"/>\n </fruits>\n</food>\n"
*** caught segfault ***
address 0x55ff44000000, cause 'memory not mapped'
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:
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=el_GR.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=el_GR.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=el_GR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=el_GR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] xml2_1.3.2 plumber_1.1.0.9000
loaded via a namespace (and not attached):
[1] compiler_4.0.4 magrittr_2.0.1 R6_2.5.0 later_1.2.0
[5] promises_1.2.0.1 tools_4.0.4 swagger_3.33.1 Rcpp_1.0.6
[9] stringi_1.6.1 jsonlite_1.7.2 webutils_1.1 lifecycle_1.0.0
[13] rlang_0.4.11
you can bypass it for example by using xml_add_child and xml_replace instead.
- 主要语言
- R
- 星标
- 227
- 派生
- 86
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
r-lib/xml2 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 67/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
Optimize xml_path() and xml_find_all() for large node sets可能已有人在做 @astruebi 于 182 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 45/100
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
Bioconductor/BiocParallel#289 ·
-
automation
难度 2/5 1-3 小时 新手友好度 68/100
waldronlab/BugSigDBcuration#2224 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
merliseclyde/BAS#118 ·