In a simple ShowBase app, I wrote and tested methods to construct a Geom, add it to a new GeomNode referenced by a new NodePath and reparent the NodePath to render. I see exactly what I expect when I dig through the Geom with getGeom(i), getGeomState(i), getVertexData(), getPrimitive(i), and GeomVertexReaders. In interactive testing, Every time I click the mouse, it correctly discards the previous GeomNode (if any), calls my Geom construction methods with some random coordinates, and reparents the resulting GeomNode to render. The constructed geometry displays fine.
When I copied the methods to a large ShowBase app, the Geom construction works as expected, but when I reparent the first resulting NodePath to render, the app locks up. If I comment-out the nodePath.reparentTo(render), the app continues to display its virtual reality including constructing additional Geoms as required (as long as it doesn’t try to display them).
What’s significantly different about the large app?
- It includes an additional task chain (with 2 threads) in which a handful of tasks use the requests library to read data from APIs for the app to present in the environment. The requests library uses urllib3, which uses Python’s standard threading module. This aspect has been working fine and continues to work fine, as long as I don’t reparent the constructed GeomNode to render. I presume that, although direct.stdpy.threading is preferred, the standard Python threading should work reliably with Panda3d.
- It typically includes several GB of loaded textures and GeomNodes. However, when running with a simple environment of less than 100MB of such, the freeze still happens at the first reparentTo(render).
- It uses popular libraries such as argparse, csv, datetime, json, math, os, pytz, re, requests, and time.
- One class has a class threading.Lock and an instance threading.Lock to coordinate critical sections between asynchronous tasks in the chains. However, the locks are not used in executing the new methods.
- The test program has only the main task chain. In the large app I generate the Geom in tasks scheduled in the additional task chain. I tried having this task leave the result GeomNode for a task in the main task chain to do the reparentTo, but this produces the same result – the first reparentTo starts the freeze.
In the freeze:
- the app’s GPU usage drops from 10% to zero and CPU usage drifts down over several seconds from 3-4% to almost 0%
- the executing task on the additional chain continues to run (GETing APIs). On completion it is never rescheduled
- The Panda display window becomes non-responsive. e.g. can’t directly close it (but can from PyCharm)
Windows 10, PyCharm 2021.1, Python 3.8, Panda3d 1.10.8
Anyone seen this before and have suggestions as to where to look?