Removed ENOTHREADSLOTS

The error doesn't happen anymore
This commit is contained in:
Ivan Skytte Jørgensen
2016-08-02 10:59:53 +02:00
parent 23176110bd
commit a80356ef78
4 changed files with 8 additions and 18 deletions

@ -80,8 +80,6 @@ const char *mstrerror ( int errnum ) {
return "Multicast can not find any hosts";
case ENOSLOTS :
return "No udp slots available";
case ENOTHREADSLOTS :
return "No room for thread in thread queue";
case EURLTOOLONG :
return "Url too long";
case EDOCADULT :
@ -272,7 +270,7 @@ static const char* s_errname[] {
STRINGIFY( ENODOCID ),
STRINGIFY( ENOHOSTS ),
STRINGIFY( ENOSLOTS ),
STRINGIFY( ENOTHREADSLOTS ),
STRINGIFY( EUNUSED52 ),
STRINGIFY( EUNUSED7 ),
STRINGIFY( EUNUSED8 ),
STRINGIFY( EURLTOOLONG ),

@ -47,7 +47,7 @@ enum {
ENODOCID , // used in titledb/Msg24.cpp
ENOHOSTS , // multicast can't find any hosts
ENOSLOTS , // multicast can't use more than X slots
ENOTHREADSLOTS , // no more room in thread queue
EUNUSED52 ,
EUNUSED7 ,
EUNUSED8 , // 32800
EURLTOOLONG ,

@ -674,7 +674,7 @@ bool Msg3::readList ( char rdbId ,
}
// break on an error, and remember g_errno in case we block
if ( g_errno && g_errno != ENOTHREADSLOTS ) {
if ( g_errno ) {
int32_t tt = LOG_WARN;
if ( g_errno == EFILECLOSED ) tt = LOG_INFO;
log(tt,"disk: Reading %s had error: %s.",
@ -762,13 +762,6 @@ bool Msg3::doneScanning ( ) {
if ( g_errno == EBUFTOOSMALL && m_maxRetries == -1 ) max = 0;
// msg0 sets maxRetries to 2, don't let max stay set to -1
if ( g_errno == EBUFTOOSMALL && m_maxRetries != -1 ) max = m_maxRetries;
// . if no thread slots available, that hogs up serious memory.
// the size of Msg3 is 82k, so having just 5000 of them is 430MB.
// . i just made Msg3 alloc mem when it needs more than about 2k
// so this problem is greatly reduced, therefore let's keep
// retrying... forever if no thread slots in thread queue since
// we become the thread queue in a way.
if ( g_errno == ENOTHREADSLOTS ) max = -1;
// this is set above if the map has the same consecutive key repeated
// and the read is enormous
if ( g_errno == ECORRUPTDATA ) max = 0;
@ -868,7 +861,7 @@ bool Msg3::doneScanning ( ) {
// print the error
static time_t s_time = 0;
time_t now = getTime();
if ( now - s_time > 5 || g_errno != ENOTHREADSLOTS ) {
if ( now - s_time > 5 ) {
log(LOG_WARN, "net: Had error reading %s: %s. Retrying. (retry #%" PRId32")",
base->m_dbname,mstrerror(m_errno) , m_retryNum );
s_time = now;

@ -232,8 +232,7 @@ bool RdbMerge::resumeMerge ( ) {
// if g_errno is out of memory then msg3 wasn't able to get the lists
// so we should sleep and retry...
// or if no thread slots were available...
if ( g_errno == ENOMEM || g_errno == ENOTHREADSLOTS ) {
if ( g_errno == ENOMEM ) {
doSleep();
return false;
}
@ -430,7 +429,7 @@ void gotListWrapper ( void *state , RdbList *list , Msg5 *msg5 ) {
loop:
// if g_errno is out of memory then msg3 wasn't able to get the lists
// so we should sleep and retry
if ( g_errno == ENOMEM || g_errno == ENOTHREADSLOTS ) {
if ( g_errno == ENOMEM ) {
THIS->doSleep(); return; }
// if g_errno we're done
if ( g_errno || THIS->m_doneMerging ) { THIS->doneMerging(); return; }
@ -442,7 +441,7 @@ void gotListWrapper ( void *state , RdbList *list , Msg5 *msg5 ) {
goto loop;
}
// called after sleeping for 1 sec because of ENOMEM or ENOTHREADSLOTS
// called after sleeping for 1 sec because of ENOMEM
void tryAgainWrapper ( int fd , void *state ) {
// if power is still off, keep things suspended
if ( ! g_process.m_powerIsOn ) return;
@ -472,7 +471,7 @@ void dumpListWrapper ( void *state ) {
if ( ! THIS->getNextList() ) return;
// if g_errno is out of memory then msg3 wasn't able to get the lists
// so we should sleep and retry
if ( g_errno == ENOMEM || g_errno == ENOTHREADSLOTS ) {
if ( g_errno == ENOMEM ) {
// if the dump failed, it should reset m_dump.m_offset of
// the file to what it was originally (in case it failed
// in adding the list to the map). we do not need to set