Skip to content

crash when Sorting waypoints in Quadtree #442

Closed

Description

@yakra

HighwayData @ 2661ba63dcd717d679c5ce8f6bc8c1f94103c34b
UserData @ cdaaf1365cfb7181792fa906619962143da6ffc5
DataProcessing @ d384d72

==> sulogs/siteupdate_csv-NEer-3t6p.log <==
[8.82] Sorting waypoints in Quadtree.

A little too close for comfort to the old problems Sorting colocation lists.
Did it not actually get fixed? Or is this something a little different?

See also: #441 #405 #375

Activity

  1. yakra commented on Jun 21, 2021

    @yakra
    ContributorAuthor

    Problem persists with single-threaded sort.
    Occurs when sorting points in quadtree node, not colocation lists.

  2. yakra commented on Jun 23, 2021

    @yakra
    ContributorAuthor

    There's a bad Waypoint pointer. Observed MT only; ST looks fine.
    This cause can potentially explain all known BSD bugs.

    Where's it coming from?

  3. yakra commented on Jun 24, 2021

    @yakra
    ContributorAuthor

    The Smoking Gun

    Changes from 383f269 on noreaster:
    (cd /home/yakra/TravelMapping/DataProcessing/siteupdate/cplusplus; git diff)

    • Makefile: compile with clang++ instead of g++.
    • Force single-threaded quadtree & colocation list sorting, via commenting out some ifdefs.
      • WaypointQuadtree.h
      • WaypointQuadtree.cpp
      • siteupdate.cpp
    • Debug text
      • Waypoint::sort_root_at_label: Print Waypoint* locations & the values they point to.
      • WaypointQuadtree::insert: Print locations of Waypoint*s and WaypointQuadtree nodes as insertions are made.
      • WaypointQuadtree::sort(): Print messages before & after points.sort(sort_root_at_label); & colocation list sorting.
    • To save time, condition out everything after quadtree sorting until the final timestamps.

    Results:

    $ grep -n 1ef93620 logs/siteupdate.log
    1716534:Waypoint @ 0x91ef93620 inserted into Quadtree node @ 0x91b4b1580
    8295287:                    0x7fffffffca80 points to 0x91ef93620 al.al168@US431
    8295295:                    0x7fffffffcbf0 points to 0x91ef93620 al.al168@US431
    8295302:sort_root_at_label: 0x7fffffffcd68 points to 0x91ef93620 al.al168@US431
    8295304:sort_root_at_label: 0x7fffffffcd68 points to 0x91ef93620 al.al168@US431
    8295306:sort_root_at_label: 0x7fffffffcd68 points to 0x91ef93620 al.al168@US431
    8295308:sort_root_at_label: 0x7fffffffcd68 points to 0x91ef93620 al.al168@US431
    8295359:                    0x7fffffffced0 points to 0x91ef93620 al.al168@US431
    8295414:sort_root_at_label: 0x7fffffffd048 points to 0x91ef93620 al.al168@US431
    8295455:sort_root_at_label: 0x7fffffffd048 points to 0x1ef93620

    See how we read the pointer at 0x7fffffffd048, got the address of al.al168@US431, read it again, and the value it stored magically lost 0x900000000.
    This is in a single-threaded part of the program, after points.sort(sort_root_at_label); has already been called -- siteupdate doesn't have any other instructions in flight, and std::list::sort is all we're doing.

    A pointer value decreasing by 0x900000000 is exactly what happened in #375 (comment).

    A compiler bug looks unlikely here.
    I see a couple possbilities...

    • Bad RAM? This could mean memtest86 and downtime for noreaster... :(
      • To avoid the downtime memtest86 would involve, maybe run for a while with just 32 GB on the new DIMMs?
    • A rogue pointer from some other software is writing to stuff it shouldn't. This has its own set of troubleshooting challenges...

    @jteresco, thoughts?

  4. yakra commented on Jun 25, 2021

    @yakra
    ContributorAuthor

    The Bad RAM Hypothesis is ruled out.

    • Installed FreeBSD on lab4 and duplicated the bug.
    • siteupdate -t 1 has run in a loop 929 times & counting without crashing (Edit: I finally hit ^c after 978 iterations). With >1 thread, it rarely makes it beyond the low double digits.

    This latter point is especially infuriating. It suggests the problem is in siteupdate.
    Right after, per the previous post, the evidence said the problem is not in siteupdate, because our pointer is fine and then it's not, when all that's happening is std::list::sort.

    Grasping at straws here...
    Maybe a pointer runs out of bounds in siteupdate, which messes up another process (common to both our FreeBSD systems), which later on returns fire? Sounds unlikely but whatever's going on is pretty unlikely...

    What next?
    The next couple crashes observed after the one above happened when Reading waypoints. Makes sense to tackle that issue first. Happening first in the chain of events, that could be where some pointer first goes haywire and sets us up for failure later on.

  5. yakra commented on Jun 26, 2021

    @yakra
    ContributorAuthor

    RAM Redux

    The Bad RAM Hypothesis is... Eris having a laugh at my expense.

    1. After maybe 50 passes of the next iteration of siteupdate with more debug text, lab4's front panel showed a message about RAM errors in DIMM1 thru DIMM8. Oh boy. I didn't notice when this first appeared, or if it was present around the time of the crash.
    2. So I popped the hard disk into lab3 instead.
    3. ...And now, that program that crashed right away in a low double-digit # of passes per quasi-expectation is running strong at 182 passes.
      • Either I'm unusually lucky this time thru, or...
      • I'm gonna try it out on lab4 again...

    Results

    Lab4 crashed after 360 passes. Front panel reports no errors.
    Only running siteupdate as far as Reading waypoints now, crashes are less frequent. 100+, 200+ or even 300+ passes before a crash are not uncommon.

  6. jteresco commented on Jun 26, 2021

    @jteresco
    Contributor

    If you'd like another option for testing, I can get you set up with an account on my home server, also running FreeBSD. We can arrange that by email if you're interested. It's an older machine running FreeBSD 11.4, due for an OS upgrade this summer.

  7. yakra commented on Jun 26, 2021

    @yakra
    ContributorAuthor

    Probably won't be necessary, but thanks though. I'll take a look at FreeBSD 13.0 soon, and if I decide I want to test out 11.4 as well I'll have a go at that with lab3 or lab4.

  8. yakra commented on Jun 27, 2021

    @yakra
    ContributorAuthor
    • Observed crashes with FreeBSD 13.0; didn't investigate them in detail.
    • Will probably also test out 11.4 for giggles.
  9. jteresco commented on Jun 27, 2021

    @jteresco
    Contributor

    Helpful to get a FreeBSD VM install on the Siena cloud server? I should be able to create one you could access by hopping through noreaster.

  10. yakra commented on Jun 27, 2021

    @yakra
    ContributorAuthor

    Should be easy enough to do it at home. FreeBSD installation is quick & painless, and I've hard disks to spare, easily swappable.

  11. yakra commented on Jul 6, 2021

    @yakra
    ContributorAuthor

    Closing this under the assumption it arises from the same cause as #443.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions