IOC shutdown issues in dbCa from ca_context_destroy()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
High
|
Jeff Hill |
Bug Description
When closing an IOC using exit/Ctrl-D from the iocsh, I'm getting a failure when dbCaTask is shutting down. The shutdown code checks that all dbCa links have been cleared and then calls ca_context_
The IOC console message I get is:
epicsMutex pthread_mutex_lock failed: error Invalid argument
epicsMutexOsdLo
Steps to reproduce:
Run a soft IOC on Linux that contains connected CA links to a different IOC. Shut it down with exit or Control-D.
Not seen on Solaris, but now occurs every time on Linux.
Additional information:
I've seen two different stack traces for the dbCaTask, this being the most recent:
(gdb) where
#0 0x00d19402 in __kernel_vsyscall ()
#1 0x00ca81a6 in pthread_
#2 0x004d28cd in pthread_
#3 0x007c65c7 in epicsEventWait (pevent=0x9d6eb70) at ../../.
#4 0x007c5242 in epicsThreadSusp
#5 0x007b966c in cantProceed (msg=0x7d4619 "epicsMutexOsdL
#6 0x007c5e77 in epicsMutexOsdLock (pmutex=0x9d70240) at ../../.
#7 0x007bdf60 in epicsMutexLock (pmutexNode=
#8 0x007be67f in epicsMutex::lock (this=0x9d6ed10) at ../../.
#9 0x007bb15a in ipAddrToAsciiEn
#10 0x00d5fa21 in ~cac (this=0x9db2c10) at ../cac.cpp:289
#11 0x0014d6cf in ~dbContext (this=0x9d6f670) at ../../.
#12 0x00d7f9ca in ~ca_client_context (this=0x9d6f4a8) at ../../.
#13 0x00d64e19 in ca_context_destroy () at ../access.cpp:251
#14 0x0014a91b in dbCaTask (arg=0x0) at ../dbCa.c:986
#15 0x007c512b in start_routine (arg=0x9d6eb10) at ../../.
#16 0x00ca43db in start_thread () from /lib/libpthread
#17 0x004c626e in clone () from /lib/libc.so.6
(gdb)
I have also seen this in the ~cac() routine's call to timerQueue.
The problem has to be due to the order of shutdown, but this isn't easy to track down.
OS: Linux
Platform: x86
Version: R3.14.9 R3-14-10-CVS
Original Mantis Bug: mantis-316
http://
This bug still present in R3-14-10-pre1. This is the backtrace from a 64-bit linux build:
#0 0x0000003a15e0a8f9 in pthread_ cond_wait@ @GLIBC_ 2.3.2 () libpthread. so.0 ./src/libCom/ osi/os/ posix/osdEvent. c:77 endSelf () ./src/libCom/ osi/os/ posix/osdThread .c:486 ./src/libCom/ misc/cantProcee d.c:69 ./src/libCom/ osi/os/ posix/osdMutex. c:114 ./src/libCom/ osi/epicsMutex. cpp:238 ginePrivate: :release ( ./src/libCom/ cxxTemplates/ epicsGuard. h:71 ./include/ epicsMemory. h:52 ./include/ epicsMemory. h:52 ./src/libCom/ osi/os/ posix/osdThread .c:319 libpthread. so.0
from /lib64/
#1 0x000000000106cb11 in epicsEventWait (pevent=0x160f040)
at ../../.
#2 0x000000000106ba6b in epicsThreadSusp
at ../../.
#3 0x000000000106119b in cantProceed (msg=<value optimized out>)
at ../../.
#4 0x000000000106c523 in epicsMutexOsdLock (pmutex=<value optimized out>)
at ../../.
#5 0x0000000001065b1c in epicsMutex::lock (this=<value optimized out>)
at ../../.
#6 0x00000000010629dd in ipAddrToAsciiEn
this=<value optimized out>)
at ../../.
#7 0x00000000066ea541 in ~cac (this=0x1633fb0) at ../cac.cpp:289
#8 0x000000000378cef9 in ~dbContext (this=0x160f5a0)
at ../../.
#9 0x0000000006705e88 in ~ca_client_context (this=0x160f290)
at ../../.
#10 0x00000000066eea76 in ca_context_destroy () at ../access.cpp:251
#11 0x000000000378a406 in dbCaTask (arg=<value optimized out>)
at ../dbCa.c:986
#12 0x000000000106b973 in start_routine (arg=<value optimized out>)
at ../../.
#13 0x0000003a15e06407 in start_thread () from /lib64/
#14 0x0000003a152d4b0d in clone () from /lib64/libc.so.6