NOINLINE_DECL void invariantFailed(const char* expr, const char* file, unsigned line) { log() << "Invariant failure " << expr << ' ' << file << ' ' << dec << line << endl; logContext(); breakpoint(); log() << "\n\n***aborting after invariant() failure\n\n" << endl; quickExit(EXIT_ABRUPT); }
NOINLINE_DECL void msgasserted(int msgid, const char* msg) { assertionCount.condrollover(++assertionCount.warning); log() << "Assertion: " << msgid << ":" << msg << endl; // breakpoint(); logContext(); throw MsgAssertionException(msgid, msg); }
NOINLINE_DECL void fassertFailed( int msgid ) { problem() << "Fatal Assertion " << msgid << endl; logContext(); breakpoint(); log() << "\n\n***aborting after fassert() failure\n\n" << endl; abort(); }
/* * Johnny NOINLINE_DECL: do not treat function as inline function. * Why? * * Pay attention to rate limit, why? this calls a lot? */ NOINLINE_DECL void wasserted(const char *msg, const char *file, unsigned line) { static bool rateLimited; static time_t lastWhen; static unsigned lastLine; if( lastLine == line && time(0)-lastWhen < 5 ) { if( !rateLimited ) { rateLimited = true; log() << "rate limiting wassert" << endl; } return; } lastWhen = time(0); lastLine = line; problem() << "warning assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; // Johnny log context? can't find where. logContext(); // Johnny set last error setLastError(0,msg && *msg ? msg : "wassertion failure"); assertionCount.condrollover( ++assertionCount.warning ); #if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF) // this is so we notice in buildbot log() << "\n\n***aborting after wassert() failure in a debug/test build\n\n" << endl; abort(); #endif }
NOINLINE_DECL void invariantFailed(const char *msg, const char *file, unsigned line) { log() << "Invariant failure " << msg << ' ' << file << ' ' << dec << line << endl; logContext(); breakpoint(); log() << "\n\n***aborting after invariant() failure\n\n" << endl; abort(); }
NOINLINE_DECL void fassertFailed(int msgid) { log() << "Fatal Assertion " << msgid << endl; logContext(); breakpoint(); log() << "\n\n***aborting after fassert() failure\n\n" << endl; quickExit(EXIT_ABRUPT); }
MONGO_COMPILER_NORETURN void fassertFailedWithStatus(int msgid, const Status& status) { log() << "Fatal assertion " << msgid << " " << status; logContext(); breakpoint(); log() << "\n\n***aborting after fassert() failure\n\n" << endl; quickExit(EXIT_ABRUPT); }
NOINLINE_DECL void msgasserted(int msgid, const char *msg) { assertionCount.condrollover( ++assertionCount.warning ); tlog() << "Assertion: " << msgid << ":" << msg << endl; setLastError(msgid,msg && *msg ? msg : "massert failure"); //breakpoint(); logContext(); throw MsgAssertionException(msgid, msg); }
NOINLINE_DECL void verifyFailed(const char *expr, const char *file, unsigned line) { log() << "Assertion failure " << expr << ' ' << file << ' ' << dec << line << endl; logContext(); stringstream temp; temp << "assertion " << file << ":" << line; AssertionException e(temp.str(),0); throw e; }
NOINLINE_DECL void invariantOKFailed(const char* expr, const Status& status, const char *file, unsigned line) { log() << "Invariant failure: " << expr << " resulted in status " << status << " at " << file << ' ' << dec << line; logContext(); log() << "\n\n***aborting after invariant() failure\n\n" << endl; abort(); }
NOINLINE_DECL void msgassertedWithLocation(int msgid, const char* msg, const char* file, unsigned line) { assertionCount.condrollover(++assertionCount.warning); log() << "Assertion: " << msgid << ":" << redact(msg) << ' ' << file << ' ' << dec << line << endl; logContext(); throw MsgAssertionException(msgid, msg); }
void IndexAccessMethod::removeOneKey(OperationContext* txn, const BSONObj& key, const RecordId& loc, bool dupsAllowed) { try { _newInterface->unindex(txn, key, loc, dupsAllowed); } catch (AssertionException& e) { log() << "Assertion failure: _unindex failed " << _descriptor->indexNamespace(); log() << "Assertion failure: _unindex failed: " << redact(e) << " key:" << key.toString() << " dl:" << loc; logContext(); } }
void QuickSaves::enumerate() { clear(); logContext("parsing quick saves"); QuickSaveLoader loader; DirectorySpecifier path; path.SetToQuickSavesDir(); loader.ParseDirectory(path); clear_game_error(); std::sort(m_saves.begin(), m_saves.end()); std::reverse(m_saves.begin(), m_saves.end()); }
NOINLINE_DECL void verifyFailed(const char *msg, const char *file, unsigned line) { assertionCount.condrollover( ++assertionCount.regular ); log() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; logContext(); stringstream temp; temp << "assertion " << file << ":" << line; AssertionException e(temp.str(),0); breakpoint(); #if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF) // this is so we notice in buildbot log() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl; abort(); #endif throw e; }
NOINLINE_DECL void verifyFailed(const char* expr, const char* file, unsigned line) { assertionCount.condrollover(++assertionCount.regular); log() << "Assertion failure " << expr << ' ' << file << ' ' << dec << line << endl; logContext(); stringstream temp; temp << "assertion " << file << ":" << line; AssertionException e(temp.str(), 0); breakpoint(); #if defined(MONGO_CONFIG_DEBUG_BUILD) // this is so we notice in buildbot log() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl; quickExit(EXIT_ABRUPT); #endif throw e; }
void BtreeBasedAccessMethod::removeOneKey(OperationContext* txn, const BSONObj& key, const DiskLoc& loc, bool dupsAllowed) { try { _newInterface->unindex(txn, key, loc, dupsAllowed); } catch (AssertionException& e) { log() << "Assertion failure: _unindex failed " << _descriptor->indexNamespace() << endl; log() << "Assertion failure: _unindex failed: " << e.what() << '\n'; log() << " key:" << key.toString() << '\n'; log() << " dl:" << loc.toString() << endl; logContext(); } }
/** * get QuotaData from zfs for the given QuotaData which is initialized with type and ID * * @param blockDevice the QuotaBlockDevice to check * @param targetNumID the targetNumID of the storage target * @param zfsPropertyString could be an empty string, is initialized during the first execution of * this function and should be reused during the next call for the next * QuotaBlockDevice (example: "userused@5111") * @param outData needs to be initialized with type and ID * @param session a session for all required lib handles if zfs is used, it can be an uninitialized * session, the initialization can be done by this function * @return false on error (in which case outData is not initialized) */ bool QuotaTk::requestQuotaFromZFS(QuotaBlockDevice* blockDevice, uint16_t targetNumID, std::string* zfsPropertyString, QuotaData* outData, ZfsSession* session) { std::string logContext("requestQuotaFromZFS"); App* app = Program::getApp(); Logger* log = app->getLogger(); if(!session->isSessionValid() ) { outData->setIsValid(false); return false; } void* zfsHandle = session->getZfsDeviceHandle(targetNumID, blockDevice->getBlockDevicePath() ); if(!zfsHandle) return false; uint64_t usedSizeValue = 0; if(zfsPropertyString->empty() ) { if(outData->getType() == QuotaDataType_USER) zfsPropertyString->assign(QUOTATK_ZFS_USER_QUOTA + StringTk::uintToStr(outData->getID() ) ); else zfsPropertyString->assign(QUOTATK_ZFS_GROUP_QUOTA + StringTk::uintToStr(outData->getID() ) ); } int error = (*session->zfs_prop_get_userquota_int)(zfsHandle, zfsPropertyString->c_str(), &usedSizeValue); if(error) { std::string errorDec( (*session->libzfs_error_description)(session->getlibZfsHandle() ) ); std::string errorAct( (*session->libzfs_error_action)(session->getlibZfsHandle() ) ); log->logErr(logContext, "error during request quota data. " + errorAct + "; " + errorDec); return false; } // inode value is every time 0, because zfs doesn't support inode quota outData->setQuotaData(usedSizeValue, 0); return true; }
bool BtreeBasedAccessMethod::removeOneKey(const BSONObj& key, const DiskLoc& loc) { bool ret = false; try { ret = _newInterface->unindex(key, loc); } catch (AssertionException& e) { problem() << "Assertion failure: _unindex failed " << _descriptor->indexNamespace() << endl; out() << "Assertion failure: _unindex failed: " << e.what() << '\n'; out() << " obj:" << loc.obj().toString() << '\n'; out() << " key:" << key.toString() << '\n'; out() << " dl:" << loc.toString() << endl; logContext(); } return ret; }
/* "warning" assert -- safe to continue, so we don't throw exception. */ NOINLINE_DECL void wasserted(const char* expr, const char* file, unsigned line) { static bool rateLimited; static time_t lastWhen; static unsigned lastLine; if( lastLine == line && time(0)-lastWhen < 5 ) { if( !rateLimited ) { rateLimited = true; log() << "rate limiting wassert" << endl; } return; } lastWhen = time(0); lastLine = line; log() << "warning assertion failure " << expr << ' ' << file << ' ' << dec << line << endl; logContext(); }
void Plugins::enumerate() { PluginParser.AddChild(&PluginMMLParser); PluginRootParser.AddChild(&PluginParser); logContext("parsing plugins"); PluginLoader loader; loader.CurrentElement = &PluginRootParser; for (std::vector<DirectorySpecifier>::const_iterator it = data_search_path.begin(); it != data_search_path.end(); ++it) { DirectorySpecifier path = *it + "Plugins"; loader.ParseDirectory(path); } std::sort(m_plugins.begin(), m_plugins.end()); clear_game_error(); }
/* "warning" assert -- safe to continue, so we don't throw exception. */ NOINLINE_DECL void wasserted(const char* expr, const char* file, unsigned line) { static bool rateLimited; static time_t lastWhen; static unsigned lastLine; if (lastLine == line && time(0) - lastWhen < 5) { if (!rateLimited) { rateLimited = true; log() << "rate limiting wassert" << endl; } return; } lastWhen = time(0); lastLine = line; log() << "warning assertion failure " << expr << ' ' << file << ' ' << dec << line << endl; logContext(); assertionCount.condrollover(++assertionCount.warning); #if defined(MONGO_CONFIG_DEBUG_BUILD) // this is so we notice in buildbot log() << "\n\n***aborting after wassert() failure in a debug/test build\n\n" << endl; quickExit(EXIT_ABRUPT); #endif }
MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTrace(int msgid, const Status& status) { log() << "Fatal assertion " << msgid << " " << status; logContext(); log() << "\n\n***aborting after fassert() failure\n\n" << endl; abort(); }
static void read_recording_queue_chunks( void) { logContext("reading recording queue chunks"); int32 i, sizeof_read; uint32 action_flags; int16 count, player_index, num_flags; ActionQueue *queue; for (player_index = 0; player_index < dynamic_world->player_count; player_index++) { queue= get_player_recording_queue(player_index); for (count = 0; count < RECORD_CHUNK_SIZE; ) { if (replay.resource_data) { bool hit_end= false; if (replay.film_resource_offset >= replay.resource_data_size) { hit_end = true; } else { uint8* S; S = (uint8 *)(replay.resource_data + replay.film_resource_offset); StreamToValue(S,num_flags); replay.film_resource_offset += sizeof(num_flags); S = (uint8 *)(replay.resource_data + replay.film_resource_offset); StreamToValue(S,action_flags); replay.film_resource_offset+= sizeof(action_flags); } if (hit_end || num_flags == END_OF_RECORDING_INDICATOR) { replay.have_read_last_chunk= true; break; } } else { sizeof_read = sizeof(num_flags); uint8 NumFlagsBuffer[sizeof(num_flags)]; bool HitEOF = false; if (vblFSRead(FilmFile, &sizeof_read, NumFlagsBuffer, HitEOF)) { uint8 *S = NumFlagsBuffer; StreamToValue(S,num_flags); sizeof_read = sizeof(action_flags); uint8 ActionFlagsBuffer[sizeof(action_flags)]; bool status = vblFSRead(FilmFile, &sizeof_read, ActionFlagsBuffer, HitEOF); S = ActionFlagsBuffer; StreamToValue(S,action_flags); assert(status || (HitEOF && sizeof_read == sizeof(action_flags))); } if ((HitEOF && sizeof_read != sizeof(action_flags)) || num_flags == END_OF_RECORDING_INDICATOR) { replay.have_read_last_chunk = true; break; } } if (!(replay.have_read_last_chunk || num_flags)) { logAnomaly("chunk contains no flags"); } count += num_flags; for (i = 0; i < num_flags; i++) { *(queue->buffer + queue->write_index) = action_flags; INCREMENT_QUEUE_COUNTER(queue->write_index); assert(queue->read_index != queue->write_index); } } assert(replay.have_read_last_chunk || count == RECORD_CHUNK_SIZE); } }
NOINLINE_DECL void msgasserted(int msgid, const char *msg) { log() << "Assertion: " << msgid << ":" << msg << endl; logContext(); throw MsgAssertionException(msgid, msg); }