Paraview crashes for plain text .xdmf files (ASCII encoding)

Consider the following .xdmf file generation:

import numpy as np
from mpi4py import MPI
from dolfinx.mesh import create_box, CellType
from dolfinx.io import XDMFFile

#n=56 # This size still works fine

n=57 # This size makes paraview crash
mesh = create_box(MPI.COMM_WORLD, [np.array([0,0,0]), np.array([1,1,1])], [n,n,n], CellType.hexahedron)

encoding=XDMFFile.Encoding.ASCII
#encoding=XDMFFile.Encoding.HDF5

with XDMFFile(MPI.COMM_WORLD, ‘testmesh.xdmf’, “w”, encoding=encoding) as file:
   file.write_mesh(mesh)

The output file makes Paraview crash. It opens fine for smaller mesh files (n<57) with the ASCII encoding. With the HDF5 encoding I don’t encounter any problems at all. Is there an inherent limitation in Paraview for ASCII encoding?

To me it seems like a bug in Paraview for ASCII formatting of large files (Xdmf3ReaderT crashes if xdmf mesh file (plain text) exceeds certain number of elements - ParaView Support - ParaView)
and I would strongly advice against using the ascii format, as it is not scalable whatsoever.

Running your code, I get:

/home/dokken/Documents/src/debug/testmesh.xdmf:365297: parser error : xmlSAX2Characters: huge text node
0.9473684210526315 0.4210526315789473 0.87719298245
                                                   ^
/home/dokken/Documents/src/debug/testmesh.xdmf:365297: parser error : Extra content at the end of the document
0.9473684210526315 0.4210526315789473 0.8771929824561403
                                                   ^
xmlReadFile could not read /home/dokken/Documents/src/debug/testmesh.xdmf in XdmfCoreReader::XdmfCoreReaderImpl::openFile
terminate called after throwing an instance of 'XdmfError'
  what():  xmlReadFile could not read /home/dokken/Documents/src/debug/testmesh.xdmf in XdmfCoreReader::XdmfCoreReaderImpl::openFile
error: exception occurred: Subprocess aborted

Which to me points to libxml has been set to a default size around 10 MB which you are hitting:

Seems like one would have to add XML_PARSE_HUGE to Verifying connection...
to be able to read huge XML files.