Debug weird startup bug
This commit is contained in:
@@ -1239,6 +1239,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
|
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
|
||||||
if (file) fclose(file);
|
if (file) fclose(file);
|
||||||
|
|
||||||
|
|
||||||
|
fprintf(stderr,"Attempting to obtain lock %s\n", pathLockFile.string().c_str());
|
||||||
try {
|
try {
|
||||||
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
|
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
|
||||||
if (!lock.try_lock())
|
if (!lock.try_lock())
|
||||||
@@ -1247,11 +1249,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Komodo is probably already running.") + " %s.", strDataDir, e.what()));
|
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Komodo is probably already running.") + " %s.", strDataDir, e.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr,"About to create pidfile\n");
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
CreatePidFile(GetPidFile(), getpid());
|
CreatePidFile(GetPidFile(), getpid());
|
||||||
#endif
|
#endif
|
||||||
|
fprintf(stderr,"created pidfile\n");
|
||||||
if (GetBoolArg("-shrinkdebugfile", !fDebug))
|
if (GetBoolArg("-shrinkdebugfile", !fDebug))
|
||||||
ShrinkDebugFile();
|
ShrinkDebugFile();
|
||||||
|
fprintf(stderr,"past shrinkdebugfile\n");
|
||||||
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
|
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
|
||||||
LogPrintf("Komodo version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
|
LogPrintf("Komodo version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
|
||||||
|
|
||||||
|
|||||||
@@ -750,8 +750,12 @@ void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
|
|||||||
FILE* file = fopen(path.string().c_str(), "w");
|
FILE* file = fopen(path.string().c_str(), "w");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"Creating pid file %s\n", path.string().c_str());
|
||||||
fprintf(file, "%d\n", pid);
|
fprintf(file, "%d\n", pid);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"Unable to make a pidfile %s !\n", path.string().c_str());
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -882,6 +886,7 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
|
|||||||
|
|
||||||
void ShrinkDebugFile()
|
void ShrinkDebugFile()
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"Shrinking %s\n", GetDataDir().c_str() );
|
||||||
// Scroll debug.log if it's getting too big
|
// Scroll debug.log if it's getting too big
|
||||||
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
|
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
|
||||||
FILE* file = fopen(pathLog.string().c_str(), "r");
|
FILE* file = fopen(pathLog.string().c_str(), "r");
|
||||||
|
|||||||
Reference in New Issue
Block a user