epics-base / pva2pva

PV Access gateway/proxy and EPICS Process Database integration
https://epics-base.github.io/pva2pva/
Other
4 stars 13 forks source link

Ref leak when stopping server w/ clients #12

Open mdavidsaver opened 6 years ago

mdavidsaver commented 6 years ago

When the PVA server is stopped while a clients is connected, there is a leak of a number of resources.

with no client connected

epics> refdiff
 Field : 46 (delta 16)

client connects

epics> stopPVAServer
Leaking Transport tcp transport use_count=3
2018-02-07T10:30:01.058 Closed transport 10.0.142.1:52472 still has use_count=3
Leaking ServerContext _responseHandler use_count=2
2018-02-07T10:30:01.058 ServerContextImpl::shutdown() doesn't break all internal ref. loops. use_count=20
epics> refdiff
 BlockingTCPTransportCodec : 1 (delta 1)
 Channel (ABC) : 1 (delta 1)
 ChannelBaseRequester (ABC) : 1 (delta 1)
 ChannelRequester (ABC) : 1 (delta 1)
 Field : 50 (delta 20)
 PDBSingleChannel : 1 (delta 1)
 PDBSinglePV : 1 (delta 1)
 PVField : 34 (delta 31)
 ServerChannel : 1 (delta 1)
 Transport (ABC) : 1 (delta -5)
mdavidsaver commented 6 years ago

I'm not sure if this is pvAccessCPP, or QSRV. May be related to #6.

mdavidsaver commented 6 years ago

After another round of ref. loop breaking (and other, possibly related cleanup) in pvAccessCPP this symptom seems to have gone away. epics-base/pvAccessCPP@1e0523b7b999452b6881e6b46d9f2f7a0bf1e13d

mdavidsaver commented 5 years ago

While I'm still seeing this warning occasionally. Strict testing w/ P4P has convinced me that these are transient "leaks" because server workers threads aren't always joined (depends on shutdown order).