[SERVER-1517] Turn on heapchecking in jstests on Linux 32 build Created: 30/Jul/10  Updated: 11/Dec/15  Resolved: 11/Dec/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Alberto Lerner Assignee: DO NOT USE - Backlog - Test Infrastructure Group (TIG)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-4683 switch allocator - tcmalloc or jemalloc Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Perhaps we could introduce google heap checker in our builds. Here's
how I hacked it here:

1) Compile code with -fno-frame-omit-pointer
Basically, this means we give up one register during execution.
But the location of stack frame pointers is always kept in that
register, so backtracing the stack accurately is possible without code
knowledge.
We may or may not care; need measure perf. Worst case, do it in --d builds only.

2) We link mongo, mongos, and mongod with tcmalloc
It must be the last library to be linked to.

3) In shell_utils.cpp
We need to differentiate the cases when we want to activate heap-checking.
Use execvpe() instead of execvp() and pass "HEAPCHECK=normal" in the
env, is all.

4) Say we're monitoring leaks on mongos, e.g. we're running jstests/sharding/*
s.stop would check the exit code of that process
heapcheck exits with error if it thinks it found a leak

5) Instrument mongo::mutex::~mutex() as a false positive, so that
mongos exist cleans even with that. We can hide the instrumenting code
behind ENTRY_HEAP_EXCEPTION / EXIT_HEAP_EXCEPTION macros



 Comments   
Comment by Andrew Morrow (Inactive) [ 11/Dec/15 ]

Nope, feel free to close

Comment by Kamran K. [ 11/Dec/15 ]

acm, is there value in trying to use HEAPCHECK with tcmalloc builds or should we close this now that we're using LSan with non-tcmalloc builds?

Comment by Alberto Lerner [ 01/Sep/10 ]

The heap-checker, even in 1.6 (august release), is still presenting some problems in 64 bits. The problems have been reported in the perf-tools list, so I'm hoping eventually we'll get a fix. For now, 32 bits is pretty consistent and can be installed from packages.

Comment by Eliot Horowitz (Inactive) [ 01/Sep/10 ]

Did you want to go 32 or 64 bit for this slave?
Or did you need to test perf tools on 64-bit before deciding?

Comment by Alberto Lerner [ 13/Aug/10 ]

No leaks detected in mongos in the sharding smoke tests. This is ready for the new build slave machine.

Comment by auto [ 12/Aug/10 ]

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: SERVER-1517 Start with mongos checking.
http://github.com/mongodb/mongo/commit/812d855db21e353516fbd45fb46eb9c920577ae6

Comment by auto [ 10/Aug/10 ]

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: SERVER-1517 Heapcheck 'mongod' and 'mongos' only (fix core tests)
http://github.com/mongodb/mongo/commit/04d9cfb67ca224cb7c9fcaced746a4ad559c9518

Comment by Alberto Lerner [ 10/Aug/10 ]

Fix for last commit:

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: Fix build (broken at f800c20958ba03e25e85)
http://github.com/mongodb/mongo/commit/64210308ba3a00377d211ae2e3499f65b0962591

Comment by auto [ 10/Aug/10 ]

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: SERVER-1517 allow heap-checking in jstests
http://github.com/mongodb/mongo/commit/f800c20958ba03e25e85732783a754595a433e5f

Comment by auto [ 10/Aug/10 ]

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: SERVER-1517 Add --heapcheck options to build
http://github.com/mongodb/mongo/commit/011e22c0646d118aa3908a96ba5ef6170d273e4e

Comment by auto [ 10/Aug/10 ]

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: Revert "SERVER-1517 Add --heapcheck option to build (tentative)"

This reverts commit d607f3dcdcf97b1dc7fca59f94b36d8f21e1ee53.
http://github.com/mongodb/mongo/commit/c629c8e2c2e414961c141d1b3ca22a627dd9cc65

Comment by auto [ 10/Aug/10 ]

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: SERVER-1517 Add --heapcheck option to build (tentative)
http://github.com/mongodb/mongo/commit/d607f3dcdcf97b1dc7fca59f94b36d8f21e1ee53

Comment by auto [ 09/Aug/10 ]

Author:

{'login': 'alerner', 'name': 'Alberto Lerner', 'email': 'alerner@10gen.com'}

Message: SERVER-1517 Prep work for option to heap-checking during tests
http://github.com/mongodb/mongo/commit/a902556f80e34da3c641aebf9eeb58dc94643395

Comment by Alberto Lerner [ 02/Aug/10 ]

About 4), this is a no-op. Exit codes are already checked and., If heap-checking is activated and there's a leak, mongos exits through the heap-checker with an error exit code

About 5), can be done by IgnoreObject after mutex alloc and UnIgnoreObject before mutex destruction, both within class mutex

Generated at Thu Feb 08 02:57:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.