Random behavior when getting coordinates of a UnitSquareMesh's BoundaryMesh
The call BoundaryMesh(mesh, "exterior").coordinates()
seems to randomly behave differently from first calling BoundaryMesh(mesh, "exterior")
and then using its .coordinates()
method. The attached script prints 0 when they return the same, and running it 10 times yielded non-zero output 7 times.
Bug reproduced for me in a fairly recent stable docker image, and some informal testing suggests it's present in 2018.1, but not in 2017.2, although I did not test rigorously enough to be sure.
EDIT: Prepended 3 lines to the script to rule out garbage collection.
Comments (5)
-
-
reporter I don't think that's the cause because prepending
import gc; gc.disable()
to the script does not seem to fix it. I don't know enough about Python internals to say whether there are other things which could go wrong, though. -
reporter - edited description
- attached sporadic_mwe.py
-
Fix in next: c4ddd25a66ead0cc04f58a01cdf0ca6af47d40b0
-
- changed status to resolved
- Log in to comment
A stab in the dark, the refcounting is somehow broken, such that
coordinates()
does not return something that references the boundary mesh. So when you callBoundaryMesh(...).coordinates()
, the boundary mesh is collected, and then the coordinates array holds nonsense.