Closed gbeltzmo closed 5 years ago
That logic with need_centers
and need_randoms
is quite flaky at best. Passing the centers file has always worked, while passing the randoms file has failed at least sometimes (depending on the size of the largest sphere).
What happens if you add assert(itry < Nran)
before the xcen=xran[itry]; line?
I am surprised that the itry < sizeof(xran)
passed - I would have expected sizeof(xran)
to return sizeof(DOUBLE *) == 8
.
Did you ever resolve this?
Adam just fixed it! Something was just being freed too early. On line 405 in counts_spheres_mocks_impl.c.src the free statements for xran, yran, and zran should be moved to within the if statement on line 538. Doing that seems to fix it.
On Tue, Jun 19, 2018 at 2:24 AM, Manodeep Sinha notifications@github.com wrote:
Did you ever resolve this?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmanodeep%2FCorrfunc%2Fissues%2F150%23issuecomment-398301109&data=02%7C01%7Cgillian.d.beltz-mohrmann%40vanderbilt.edu%7C41fd1130f94d4893b1e008d5d5b5ba44%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C636649898844359102&sdata=EcLLOPlaGWXkbo09yrb1bWmZ1LWd65Qego6qoGXFiaY%3D&reserved=0, or mute the thread https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAX2kk_InwT67Gw6ie1awwBYBNA5wky72ks5t-Kc7gaJpZM4Slg5Q&data=02%7C01%7Cgillian.d.beltz-mohrmann%40vanderbilt.edu%7C41fd1130f94d4893b1e008d5d5b5ba44%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C636649898844359102&sdata=vBQWSBRgArZNzMQ0%2F5I0j2u39Yrh8ISawrShySDZR0w%3D&reserved=0 .
@gbeltzmo Will you please send in a PR with the fix?
Sorry @gbeltzmo -- re-opening the issue. Let's keep this issue open until the fix lands in the master
branch. Thanks again!
Fix was in #168
The fix is now in master
vpf_mocks produces a segmentation fault when not given a centers file (i.e. randoms are needed and given). After running with valgrind, I get an "Invalid read of size 8" on line 441 of countspheres_mocks_impl_double.c.
Here is what's on that line: xcen = xran[itry];
I put an assert on itry to make sure that itry < sizeof(xran), and it is. The seg fault does not seem to happen when I provide a centers file.