Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: call of ca_sg_test hangs on in preemptive mode
From: Wang Xiaoqiang <xiaoqiang.wang@psi.ch>
To: tech-talk <tech-talk@aps.anl.gov>
Date: Thu, 9 Mar 2017 13:43:19 +0100

Hi,

With the following code, I could reproduce a hangup during ca_sg_test.
https://gist.github.com/xiaoqiangwang/16576c1739e60300dde407bae044b88e

Here are the steps, the epics base is at /home/scratch/base-3.14.12.6/
$ cd /home/scratch/base-3.14.12.6/
$ ./bin/linux-x86_64/softIoc -d test.db
$ g++ -I include -I include/os/Linux ca_sg_test.cpp lib/linux-x86_64/libca.a lib/linux-x86_64/libCom.a -lrt -ldl
$ unset EPICS_CA_AUTO_ADDR_LIST
$ unset EPICS_CA_ADDR_LIST
$ while [[ 1 ]]; do ./a.out; if [[ $? -ne 0 ]]; then break; fi; done

The process will eventually hang, within 30 seconds in my case. The backtace is shown at the end of this email.

With preemptive callback disabled, the problem cannot be reproduced, at least not in minutes.

When looking at the comment of https://github.com/epics-base/epics-base/blob/3.16/src/ca/client/syncgrp.cpp#L218, it however suggests the stall would happen with non-preemptive mode. Even this "else" block actually runs in case of preemptive mode.

Best
Xiaoqiang


Thread 6 (Thread 0x7f0010ba1700 (LWP 31917)):
#0  0x000000392fa0e334 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x000000392fa095f3 in _L_lock_892 () from /lib64/libpthread.so.0
#2  0x000000392fa094d7 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x000000000043a5f6 in mutexLock (pmutex=0x1a25c10) at ../../../src/libCom/osi/os/posix/osdMutex.c:44 #4 epicsMutexOsdLock (pmutex=0x1a25c10) at ../../../src/libCom/osi/os/posix/osdMutex.c:116 #5 0x0000000000433dac in epicsMutex::lock (this=<value optimized out>) at ../../../src/libCom/osi/epicsMutex.cpp:236 #6 0x00000000004151f1 in epicsGuard (this=0x1a25eb0, mfmdpv=..., pChannelName=<value optimized out>, pAcc=<value optimized out>, pRej=<value optimized out>) at ../../../include/epicsGuard.h:68 #7 cac::pvMultiplyDefinedNotify (this=0x1a25eb0, mfmdpv=..., pChannelName=<value optimized out>, pAcc=<value optimized out>, pRej=<value optimized out>) at ../cac.cpp:1305 #8 0x000000000043267e in ipAddrToAsciiEnginePrivate::run (this=0x1a26440) at ../../../src/libCom/misc/ipAddrToAsciiAsynchronous.cpp:276 #9 0x0000000000433c19 in epicsThreadCallEntryPoint (pPvt=0x1a26898) at ../../../src/libCom/osi/epicsThread.cpp:83 #10 0x0000000000438f9f in start_routine (arg=0x1a26c00) at ../../../src/libCom/osi/os/posix/osdThread.c:389 #11 0x000000392fa07aa1 in start_thread () from /lib64/libpthread.so.0 #12 0x000000392f2e8aad in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7f00109a0700 (LWP 31918)):
#0  0x000000392fa0e334 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x000000392fa095f3 in _L_lock_892 () from /lib64/libpthread.so.0
#2  0x000000392fa094d7 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x000000000043a5f6 in mutexLock (pmutex=0x1a25c10) at ../../../src/libCom/osi/os/posix/osdMutex.c:44 #4 epicsMutexOsdLock (pmutex=0x1a25c10) at ../../../src/libCom/osi/os/posix/osdMutex.c:116 #5 0x0000000000433dac in epicsMutex::lock (this=<value optimized out>) at ../../../src/libCom/osi/epicsMutex.cpp:236 #6 0x000000000042dbf9 in epicsGuard (this=0x1a47ed0, currentTime=...) at ../../../include/epicsGuard.h:68 #7 searchTimer::expire (this=0x1a47ed0, currentTime=...) at ../searchTimer.cpp:129 #8 0x0000000000440093 in timerQueue::process (this=0x1a27050, currentTime=...) at ../../../src/libCom/timer/timerQueue.cpp:139 #9 0x000000000043dd1b in timerQueueActive::run (this=0x1a27020) at ../../../src/libCom/timer/timerQueueActive.cpp:93 #10 0x0000000000433c19 in epicsThreadCallEntryPoint (pPvt=0x1a270f0) at ../../../src/libCom/osi/epicsThread.cpp:83 #11 0x0000000000438f9f in start_routine (arg=0x1a27540) at ../../../src/libCom/osi/os/posix/osdThread.c:389 #12 0x000000392fa07aa1 in start_thread () from /lib64/libpthread.so.0 #13 0x000000392f2e8aad in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f0010691700 (LWP 31919)):
#0  0x000000392f2e98d3 in recvfrom () from /lib64/libc.so.6
---Type <return> to continue, or q <return> to quit---
#1 0x00000000004206e1 in udpRecvThread::run (this=0x1a47028) at ../udpiiu.cpp:367 #2 0x0000000000433c19 in epicsThreadCallEntryPoint (pPvt=0x1a47048) at ../../../src/libCom/osi/epicsThread.cpp:83 #3 0x0000000000438f9f in start_routine (arg=0x1a472c0) at ../../../src/libCom/osi/os/posix/osdThread.c:389 #4 0x000000392fa07aa1 in start_thread () from /lib64/libpthread.so.0 #5 0x000000392f2e8aad in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f001056b700 (LWP 31920)):
#0  0x000000392f2e985c in recv () from /lib64/libc.so.6
#1 0x0000000000424563 in tcpiiu::recvBytes (this=0x7f000c0008c0, pBuf=0x7f00101ed04c, nBytesInBuf=16384, stat=...)
    at ../tcpiiu.cpp:304
#2 0x0000000000426542 in fillFromWire (this=0x7f000c0009a8) at ../comBuf.h:182
#3  tcpRecvThread::run (this=0x7f000c0009a8) at ../tcpiiu.cpp:474
#4  0x0000000000433c19 in epicsThreadCallEntryPoint (pPvt=0x7f000c0009b0)
    at ../../../src/libCom/osi/epicsThread.cpp:83
#5 0x0000000000438f9f in start_routine (arg=0x7f000c009ea0) at ../../../src/libCom/osi/os/posix/osdThread.c:389
#6  0x000000392fa07aa1 in start_thread () from /lib64/libpthread.so.0
#7  0x000000392f2e8aad in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f001036a700 (LWP 31921)):
#0  0x000000392fa0e334 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x000000392fa095f3 in _L_lock_892 () from /lib64/libpthread.so.0
#2  0x000000392fa094d7 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x000000000043a5f6 in mutexLock (pmutex=0x1a25c10) at ../../../src/libCom/osi/os/posix/osdMutex.c:44 #4 epicsMutexOsdLock (pmutex=0x1a25c10) at ../../../src/libCom/osi/os/posix/osdMutex.c:116
#5  0x0000000000433dac in epicsMutex::lock (this=<value optimized out>)
    at ../../../src/libCom/osi/epicsMutex.cpp:236
#6 0x00000000004273b6 in ~epicsGuardRelease (this=0x7f000c000a00) at ../../../include/epicsGuard.h:103
#7  tcpSendThread::run (this=0x7f000c000a00) at ../tcpiiu.cpp:84
#8  0x0000000000433c19 in epicsThreadCallEntryPoint (pPvt=0x7f000c000a08)
    at ../../../src/libCom/osi/epicsThread.cpp:83
#9 0x0000000000438f9f in start_routine (arg=0x7f000c00a370) at ../../../src/libCom/osi/os/posix/osdThread.c:389
#10 0x000000392fa07aa1 in start_thread () from /lib64/libpthread.so.0
#11 0x000000392f2e8aad in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f00115a4720 (LWP 31915)):
#0  0x000000392fa0e334 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x000000392fa095f3 in _L_lock_892 () from /lib64/libpthread.so.0
#2  0x000000392fa094d7 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x000000000043a5f6 in mutexLock (pmutex=0x1a25c80) at ../../../src/libCom/osi/os/posix/osdMutex.c:44 #4 epicsMutexOsdLock (pmutex=0x1a25c80) at ../../../src/libCom/osi/os/posix/osdMutex.c:116
#5  0x0000000000433dac in epicsMutex::lock (this=<value optimized out>)
---Type <return> to continue, or q <return> to quit---
    at ../../../src/libCom/osi/epicsMutex.cpp:236
#6 0x000000000040f327 in epicsGuard (gid=<value optimized out>) at ../../../include/epicsGuard.h:68
#7  CallbackGuard (gid=<value optimized out>) at ../cacIO.h:159
#8  ca_sg_test (gid=<value optimized out>) at ../syncgrp.cpp:228
#9  0x0000000000408561 in main ()

Navigate by Date:
Prev: Re: 3.15 build rules suppress crash message [was: EPICS make problem] J. Lewis Muir
Next: DAQ/Controls software position Hartman, Steven M.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: stream device user variables Al Honey
Next: Questions about css boy opi be run as a standalone program lzf neu
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 10 Mar 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·