epicsThreadTest crashes on vxWorks 6.9.0

Bug #1956459 reported by Dirk Zimoch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
New
Undecided
Unassigned

Bug Description

Since commit 8fdaa13 "errlog: eltc() re-add flush", epicsThreadTest (and thus epicsRunLibComTests) crashes on vxWorks 6.9.0 (but not on 6.7!) on my mv5100 PPC IOC:

------------------------------------
epicsThreadTest > logfile

program
Exception current instruction address: 0x00000004
Machine Status Register: 0x0208b032
Condition Register: 0x84000882

trcStack aborted: error in top frame
------------------------------------

Unfortunately the stack is so corrupted that it is not tracable.
The faulty address 0x00000004 hints to a dereferenced NULL pointer.

After the test, the logfile contains:
------------------------------------

***** epicsThreadTest *****
1..15
# System has 1 CPUs
ok 1 - ncpus > 0
# main() thread 0x51a8c0
not ok 2 - Join delayed parent (0 seconds) # TODO Thread join doesn't work
ok 3 - Join tests #1 completed
not ok 4 - Join delayed parent (0 seconds) # TODO Thread join doesn't work
ok 5 - Join tests #2 completed
ok 6 - pget == pset
ok 7 - thread.getPriority() == epicsThreadGetPriority(self)
ok 8 - pget == pset
ok 9 - thread.getPriority() == epicsThreadGetPriority(self)
ok 10 - pget == pset
ok 11 - thread.getPriority() == epicsThreadGetPriority(self)
not ok 12 - infoB.didSomething
not ok 13 - infoA.didSomething
not ok 14 - threadA epicsThreadIsOkToBlock() = 1280
not ok 15 - threadB epicsThreadIsOkToBlock() = 6279168
------------------------------------

It ends just before the test results are printed.

My analysis shows that the crash is most likely related to the fact that epicsThreadMustJoin() is non-functional on vxWorks 6.9.0 and thus testOkToBlock() exits before the test threads finish. This takes the local variables infoA and infoB out of context while the test threads are still using them. This overwrites local variables (or the call stack) in the next function eltc().

The solution is to make infoA and infoB static (or global). Or skip the whole test #ifndef EPICS_THREAD_CAN_JOIN.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.