# Xdmf reader crashes: "entity reference loop"

**URL:** https://discourse.paraview.org/t/xdmf-reader-crashes-entity-reference-loop/3518
**Category:** ParaView Support
**Created:** [February 6, 2020, 10:30am UTC](https://discourse.paraview.org/t/xdmf-reader-crashes-entity-reference-loop/3518 "2020-02-06T10:30:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bastian](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bastian/32/7513_2.png) [@bastian](https://discourse.paraview.org/u/bastian)
#### Post date: [February 6, 2020, 10:30am UTC](https://discourse.paraview.org/t/xdmf-reader-crashes-entity-reference-loop/3518/1 "2020-02-06T10:30:21Z")

</div>

Hello,

here’s an odd bug.

I’m trying to load a bunch of data stored in binary files via an Xdmf wrapper file.  
I’ve been doing this for quite some time without much trouble, but here’s an Xdmf file that just won’t load and I have no Idea why.

`A.xmf` and `B.xmf` are loaded just fine, but `A+B.xmf` won’t load, although both `A.xmf` and `B.xmf` are contained in `A+B.xmf`.

[B.xmf](https://discourse.paraview.org/uploads/short-url/a0HAQrC5ANVBy9DF0Zh1kLYc7GW.xmf) (81.4 KB) [A.xmf](https://discourse.paraview.org/uploads/short-url/kxhMph8vdIKpZ9KoKaNjLTjvaaQ.xmf) (475.3 KB) [A+B.xmf](https://discourse.paraview.org/uploads/short-url/lPh89o4bH0jyhNwffxjQMeYyaDA.xmf) (479.5 KB)

![01_select_file](https://discourse.paraview.org/uploads/default/original/2X/8/8f22c7dbc8ef857a241ec89bdab3605c2aae11a9.png) ![02_select_reader](https://discourse.paraview.org/uploads/default/original/2X/d/d5b5783638ceb451fda3548ec9e19c975a028321.png)

After loading `A.xmf`:

 ![03_loaded](https://discourse.paraview.org/uploads/default/original/2X/d/d1e52386514ae531e4fc2c2dffecf2ff0d8c63ed.png)

After loading `B.xmf`:

 ![04_loaded](https://discourse.paraview.org/uploads/default/original/2X/2/25868f008a3590fc20776f51ccef9c939ee5cd02.png)

While loading `A+B.xmf` ParaView crashes:

```auto
/home/some/path/A+B.xmf:5645: parser error : Detected an entity reference loop
 <DataItem Dimensions="&Nx;" NumberType="Float" Precision="4" Format="XML">&xst;
                                                                               ^

```

**Test: vary number of fields and grids**

`A+B.xmf` contains five fields on four grids for roughly 100 times.  
The number of data does not appear to be problematic, because all of the following files load fine:

- [centered\_02\_fields.xmf](https://discourse.paraview.org/uploads/short-url/cIRpMjttXDhMVg0Rzq23zvJ6bEq.xmf) (199.1 KB) with 2 fields on 1 grid
- [centered\_16\_fields.xmf](https://discourse.paraview.org/uploads/short-url/mk4vvArnCFXhEIowTvI2bf3Hy4S.xmf) (592.1 KB) with 16 fields on 1 grid
- [staggered\_03\_fields.xmf](https://discourse.paraview.org/uploads/short-url/3MiVMqITGITr5PqNM0BEJO1V6s1.xmf) (390.1 KB) with 3 fields on 3 grids that are not contained in `centered_02_fields.xmf`
- [staggered\_24\_fields.xmf](https://discourse.paraview.org/uploads/short-url/hfXRjQ0s5okCuGq0GYW5bWSgxBF.xmf) (1.4 MB) with 24 fields on 3 grids

**Test: switch the order in which grids are written to the file**

Here I switch the order in which grids are written to the file.  
Interestingly, the error message points at the same line (5645) as before which is now a totally different entity. [switched.xmf](https://discourse.paraview.org/uploads/short-url/f749SxMJxBvu3IfMGDXoetn7tMV.xmf) (500.5 KB)

```auto
/some/path/switched.xmf:5645: parser error : Detected an entity reference loop
 <DataItem Dimensions="&Nx;" NumberType="Float" Precision="4" Format="XML">&xce;
                                                                               ^

```

**Test: without custom entities**  
Finally, a version identical to `A+B.xmf` but where grid data is explicitly written to file instead of using custom entities:  
[nocustomentities.xmf](https://cloudstore.zih.tu-dresden.de/index.php/s/wqdny8NsfJgNeqY/download) (11MB)  
This file works just fine

**Conclusion?**

The handling of custom entities appears to be broken.  
Anything else?

Best,  
Bastian

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [March 21, 2020, 1:06am UTC](https://discourse.paraview.org/t/xdmf-reader-crashes-entity-reference-loop/3518/2 "2020-03-21T01:06:04Z")

</div>

I’ve [filed an issue](https://gitlab.kitware.com/vtk/vtk/issues/17812) for this. Thanks for providing test files. I don’t know if I’ll have a chance to look at it myself, but it’s on our radar now.
