krzysztofarendt / building3d

Towards 3D building physics modeling
MIT License
15 stars 1 forks source link

double free or corruption (!prev) #73

Open krzysztofarendt opened 21 hours ago

krzysztofarendt commented 21 hours ago
> python examples/ray_2_boxes_example.py 

Simulation loop started
Collecting polygon points and faces from the array format
Making the voxel grid
X limits: 0.0 2.0
Y limits: 0.0 1.0
Z limits: 0.0 1.0
double free or corruption (!prev)
Aborted (core dumped)

Possibly related: https://stackoverflow.com/questions/60207653/numba-double-free-or-corruption-prev-aborted-core-dumped

The problem is that list.append method is not thread safe. If you comment out that line, you wont get the error Admittedly Numba documentation can be sparse. But it does mention that when using prange, it's up to the user to ensure there are no "cross iteration dependencies" link

krzysztofarendt commented 7 hours ago

This bug happens only from time to time. I believe it is because I'm using prange() and multiple threads sometimes try to write to the same element of the hits array (hits[sn] += energy[rn]).

Fixed in 09ae2faecdead74e130b4dfaefab634146fa3b1d