Yes, the exception (overflow in nanosecond field) is caught in EPICS Base
3.14.12, but the root cause of the exception is not resolved. I've checked
the code at line 486 of base-3.14.12\src\libCom\osi\os\WIN32\osdTime.cpp,
there is still possible negative epicsTimeFromCurrentFileTime if system
returns a filetime before the EPICS Epoch. During such situations, we may
consider how to adjust the 'perfCounterFreq' which is currently
implemented by line 489 to 520 in file
base-3.14.12\src\libCom\osi\os\WIN32\osdTime.cpp.
Thanks,
Alex
From:
Jeff Hill <email address hidden>
To:
<email address hidden>
Date:
01/07/2011 12:26 AM
Subject:
[Bug 697516] Re: Crash occurs in Com.dll if filetime is before the EPICS
epoch
Sent by:
<email address hidden>
maybe this is fixed in recent EPICS. I see code like this which seems to
handle that exception?
void epicsThread :: printLastChanceExceptionMessage (
const char * pExceptionTypeName,
const char * pExceptionContext )
{
char date[64];
try {
epicsTime cur = epicsTime :: getCurrent (); cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f");
}
catch ( ... ) {
strcpy ( date, "<UKN DATE>" );
}
char name [128];
epicsThreadGetName ( this->id, name, sizeof ( name ) );
errlogPrintf ( "epicsThread: Unexpected C++ exception \"%s\" "
"with type \"%s\" in thread \"%s\" at %s\n", pExceptionContext, pExceptionTypeName, name, date );
errlogFlush ();
// this should behave as the C++ implementation intends when an
// exception isnt handled. If users dont like this behavior, they
// can install an application specific unexpected handler.
std::unexpected ();
}
Problem:
If system returns a filetime before the EPICS epoch, exception
std::logic_error is thrown from the 'catch' (at line 67 'catch (
std::exception & except )' and at line 83 ' catch ( ... )'). The
std::logic_error is actually thrown by the 'epicsTime cur =
epicsTime::getCurrent ();' complaining that epicsTimeStamp has overflow in
nanosecond field.
The root cause:
File: \src\libCom\osi\os\WIN32\osdTime.cpp
Function: epicsTimerNotify::expireStatus currentTime::expire ( const
epicsTime & )
Line 516:
‘LONGLONG epicsTimeFromCurrentFileTime =
( curFileTime.QuadPart - epicsEpochInFileTime ) * ET_TICKS_PER_FT_TICK;’
curFileTime could be smaller than the EPICS epoch if user changes the
system time, so this will produce a wield 'epicsTimeFromCurrentFileTime'
and we will assign its value to this->epicsTimeLast' at line 526
'this->epicsTimeLast = epicsTimeFromCurrentFileTime;'
We need to handle:
If the filetime returned by system is earlier than the EPICS epoch, how do
we generate the 'delta' (at line 520) and adjust the perfCounterFreq
accordingly.
Jeff,
Yes, the exception (overflow in nanosecond field) is caught in EPICS Base 14.12\src\ libCom\ osi\os\ WIN32\osdTime. cpp, rrentFileTime if system 14.12\src\ libCom\ osi\os\ WIN32\osdTime. cpp.
3.14.12, but the root cause of the exception is not resolved. I've checked
the code at line 486 of base-3.
there is still possible negative epicsTimeFromCu
returns a filetime before the EPICS Epoch. During such situations, we may
consider how to adjust the 'perfCounterFreq' which is currently
implemented by line 489 to 520 in file
base-3.
Thanks,
Alex
From:
Jeff Hill <email address hidden>
To:
<email address hidden>
Date:
01/07/2011 12:26 AM
Subject:
[Bug 697516] Re: Crash occurs in Com.dll if filetime is before the EPICS
epoch
Sent by:
<email address hidden>
maybe this is fixed in recent EPICS. I see code like this which seems to
handle that exception?
void epicsThread :: printLastChance ExceptionMessag e (
cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f"); GetName ( this->id, name, sizeof ( name ) );
"epicsThread: Unexpected C++ exception \"%s\" "
pExceptionCont ext, pExceptionTypeName, name, date );
const char * pExceptionTypeName,
const char * pExceptionContext )
{
char date[64];
try {
epicsTime cur = epicsTime :: getCurrent ();
}
catch ( ... ) {
strcpy ( date, "<UKN DATE>" );
}
char name [128];
epicsThread
errlogPrintf (
"with type \"%s\" in thread \"%s\" at %s\n",
errlogFlush ();
// this should behave as the C++ implementation intends when an
// exception isnt handled. If users dont like this behavior, they
// can install an application specific unexpected handler.
std::unexpected ();
}
-- /bugs.launchpad .net/bugs/ 697516
You received this bug notification because you are a direct subscriber
of the bug.
https:/
Title:
Crash occurs in Com.dll if filetime is before the EPICS epoch
Status in EPICS Base:
New
Bug description:
EPICS Base 3.14.9
File: \src\libCom\ osi\epicsThread .cpp
Function: extern "C" void epicsThreadCall EntryPoint ( void * pPvt )
Problem: :getCurrent ();' complaining that epicsTimeStamp has overflow in
If system returns a filetime before the EPICS epoch, exception
std::logic_error is thrown from the 'catch' (at line 67 'catch (
std::exception & except )' and at line 83 ' catch ( ... )'). The
std::logic_error is actually thrown by the 'epicsTime cur =
epicsTime:
nanosecond field.
The root cause: osi\os\ WIN32\osdTime. cpp y::expireStatus currentTime::expire ( const rrentFileTime = QuadPart - epicsEpochInFil eTime ) *
ET_TICKS_ PER_FT_ TICK;’ urrentFileTime' Last' at line 526 epicsTimeLast = epicsTimeFromCu rrentFileTime; '
File: \src\libCom\
Function: epicsTimerNotif
epicsTime & )
Line 516:
‘LONGLONG epicsTimeFromCu
( curFileTime.
curFileTime could be smaller than the EPICS epoch if user changes the
system time, so this will produce a wield 'epicsTimeFromC
and we will assign its value to this->epicsTime
'this->
We need to handle:
If the filetime returned by system is earlier than the EPICS epoch, how do
we generate the 'delta' (at line 520) and adjust the perfCounterFreq
accordingly.
To unsubscribe from this bug, go to: /bugs.launchpad .net/epics- base/+bug/ 697516/ +subscribe
https:/