Skip to content

Commit

Permalink
Revert "increase StackChecker maximum to 256KB. used for _DEBUG builds"
Browse files Browse the repository at this point in the history
This reverts commit 4cc8a4b.
Broke Linux 32-bit debug builds -- "test" is segfaulting in StackChecker
SERVER-5804
  • Loading branch information
milkie committed May 10, 2012
1 parent 9c1fde0 commit c8396e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
10 changes: 4 additions & 6 deletions src/mongo/db/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ namespace mongo {
#if defined(_DEBUG)
struct StackChecker;
ThreadLocalValue<StackChecker *> checker;

struct StackChecker {
enum { SZ = 256 * 1024 };
enum { SZ = 192 * 1024 };
char buf[SZ];
StackChecker() {
checker.set(this);
Expand All @@ -74,18 +75,15 @@ namespace mongo {
log() << "thread " << tname << " stack usage was " << numberBytesUsed << " bytes, "
<< " which is the most so far" << endl;
}

if ( numberBytesUsed > ( SZ - 16000 ) ) {
// we are within 16000 bytes of SZ
log() << "stack used " << numberBytesUsed << " bytes, StackChecker max is " << (int)SZ << " exiting" << endl;
log() << "used " << numberBytesUsed << " bytes, max is " << (int)SZ << " exiting" << endl;
fassertFailed( 16151 );
}

}
};
void stackCheck(const char *name) { StackChecker::check(name); }
#else
void stackCheck(const char *) {}
#endif

/* each thread which does db operations has a Client object in TLS.
Expand Down
5 changes: 1 addition & 4 deletions src/mongo/dbtests/perftests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
using namespace bson;

namespace mongo {
void stackCheck(const char *);
namespace dbtests {
extern unsigned perfHist;
}
Expand Down Expand Up @@ -196,9 +195,7 @@ namespace PerfTests {
// return name of it
virtual string timed2(DBClientBase&) { return ""; }

virtual void post() {
stackCheck("dbtests perftests");
}
virtual void post() { }

virtual string name() = 0;

Expand Down
4 changes: 0 additions & 4 deletions src/mongo/unittest/unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

namespace mongo {

void stackCheck(const char *);

namespace unittest {

namespace {
Expand Down Expand Up @@ -183,8 +181,6 @@ namespace mongo {

log() << "going to run suite: " << name << std::endl;
results.push_back( s->run( filter ) );

stackCheck("dbtests");
}

Logstream::get().flush();
Expand Down

0 comments on commit c8396e3

Please sign in to comment.