Improved hpfs initialisation error handling. (#104)

This commit is contained in:
Ravin Perera
2020-08-04 12:05:27 +05:30
committed by GitHub
parent 88ad472254
commit 1328b06346
2 changed files with 17 additions and 7 deletions

View File

@@ -210,12 +210,16 @@ namespace cons
if (ctx.stage == 3)
{
if (apply_ledger(stg_prop) == -1)
return -1;
// node has finished a consensus round (all 4 stages).
LOG_INFO << "****Stage 3 consensus reached**** (lcl:" << ctx.lcl.substr(0, 15)
<< " state:" << ctx.state << ")";
if (apply_ledger(stg_prop) != -1)
{
// node has finished a consensus round (all 4 stages).
LOG_INFO << "****Stage 3 consensus reached**** (lcl:" << ctx.lcl.substr(0, 15)
<< " state:" << ctx.state << ")";
}
else
{
LOG_ERR << "Error occured in Stage 3 consensus execution.";
}
}
}
}
@@ -775,7 +779,10 @@ namespace cons
// TODO: Do something usefull with HP<-->SC channel.
if (sc::execute_contract(ctx.contract_ctx) == -1)
{
LOG_ERR << "Contract execution failed.";
return -1;
}
ctx.state = args.post_execution_state_hash;
extract_user_outputs_from_contract_bufmap(args.userbufs);

View File

@@ -99,7 +99,10 @@ namespace hpfs
// Check if process is still running.
if (kill(pid, 0) == -1)
{
LOG_ERR << "hpfs process " << pid << " has stopped.";
break;
}
// If hash map is enabled we check whether stat succeeds on the root hash.
// If not, we check whether the inode no. of the mounted root dir is 1.
@@ -107,7 +110,7 @@ namespace hpfs
hpfs_initialized = (stat(check_path.c_str(), &st) == 0 &&
(hash_map_enabled || st.st_ino == 1));
} while (!hpfs_initialized && ++retry_count < 100);
} while (!hpfs_initialized && ++retry_count < 200);
// Kill the process if hpfs couldn't be initialized after the wait period.
if (!hpfs_initialized)