8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Fixed CORE-6009: I/O error during "open" operation for file "/tmp/firebird/fb_trace_*" in firebird.log

This commit is contained in:
AlexPeshkoff 2019-02-22 19:52:58 +03:00
parent 971b9a8506
commit cf7a1b605d
4 changed files with 44 additions and 7 deletions

View File

@ -796,6 +796,7 @@ AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_HEADERS(iconv.h)
AC_CHECK_HEADERS(libio.h)
AC_CHECK_HEADERS(linux/falloc.h)
AC_CHECK_HEADERS(utime.h)
AC_CHECK_HEADERS(socket.h sys/socket.h sys/sockio.h winsock2.h)
AC_CHECK_DECLS(SOCK_CLOEXEC,,,[[

View File

@ -78,6 +78,10 @@
#endif
#ifdef HAVE_UTIME_H
#include <utime.h>
#endif
using namespace Firebird;
namespace os_utils
@ -248,6 +252,7 @@ bool touchFile(const char* pathname)
return true;
#else
errno = ENOSYS;
return false;
#endif
}

View File

@ -29,6 +29,7 @@
#include "../../common/classes/TempFile.h"
#include "../../common/StatusArg.h"
#include "../../common/ScanDir.h"
#include "../../common/utils_proto.h"
#include "../../jrd/err_proto.h"
#include "../../common/isc_proto.h"
@ -58,7 +59,7 @@ using namespace Firebird;
namespace Jrd {
static const FB_UINT64 TOUCH_INTERVAL = 60 * 60; // in seconds, one hour should be enough
static const FB_UINT64 TOUCH_INTERVAL = 60 * 60; // in seconds, one hour should be enough
void checkFileError(const char* filename, const char* operation, ISC_STATUS iscError)
{
@ -596,15 +597,41 @@ bool ConfigStorage::getItemLength(ITEM& tag, ULONG& len)
void ConfigStorage::TouchFile::handler()
{
os_utils::touchFile(fileName);
FbLocalStatus s;
TimerInterfacePtr()->start(&s, this, TOUCH_INTERVAL * 1000 * 1000);
// ignore error in handler
try
{
ScanDir dir(dirName.c_str(), "*");
while (dir.next())
{
PathName cur(dir.getFilePath());
if (cur == "." || cur == "..")
continue;
try
{
if (!os_utils::touchFile(cur.c_str()))
system_call_failed::raise("utime");
}
catch (const Exception& e)
{
iscLogException("touchFile", e);
}
}
FbLocalStatus s;
TimerInterfacePtr()->start(&s, this, TOUCH_INTERVAL * 1000 * 1000);
s.check();
}
catch (const Exception& e)
{
iscLogException("Start TouchFile timer failed", e);
}
}
void ConfigStorage::TouchFile::start(const char* fName)
{
fileName = fName;
PathName dummy;
PathUtils::splitLastComponent(dirName, dummy, fName);
FbLocalStatus s;
TimerInterfacePtr()->start(&s, this, TOUCH_INTERVAL * 1000 * 1000);
check(&s);

View File

@ -78,12 +78,16 @@ private:
public Firebird::RefCntIface<Firebird::ITimerImpl<TouchFile, Firebird::CheckStatusWrapper> >
{
public:
TouchFile()
: dirName(getPool())
{ }
void handler();
void start(const char* fName);
void stop();
int release();
private:
const char* fileName;
Firebird::PathName dirName;
};
Firebird::RefPtr<TouchFile> m_timer;