p4p
p4p copied to clipboard
Possible mishandling of an obscure type
Getting the error
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: ERROR:p4p.gw:Error during periodic sweep
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: Traceback (most recent call last):
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: File "/opt/conda/envs/pva-gateway/lib/python3.7/site-packages/p4p/gw.py", line 723, in run
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: self.stats.update_stats(period)
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: File "/opt/conda/envs/pva-gateway/lib/python3.7/site-packages/p4p/gw.py", line 348, in update_stats
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: self.tbl_dsbyhosttx.post(C.execute('SELECT account, peer, tx as rate FROM dsbypeer ORDER BY rate DESC LIMIT 10'))
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: File "/opt/conda/envs/pva-gateway/lib/python3.7/site-packages/p4p/server/raw.py", line 162, in post
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: _SharedPV.post(self, self._wrap(value, **kws))
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: File "/opt/conda/envs/pva-gateway/lib/python3.7/site-packages/p4p/gw.py", line 72, in wrap
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: ret.value[k] = C
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: File "_p4p.pyx", line 192, in p4p._p4p._Value.__setitem__
jun 27 15:00:28 idmz-ro-epics-gw-tn.esss.lu.se pvagw[1019]: RuntimeError: Assign StringA from sequence of str|bytes, not int
I guess a PV could be lying about its type and is pushing out a integer instead.
https://github.com/mdavidsaver/p4p/blob/739b6eeef938f1eb889f243e4d898f1d7ae24677/src/p4p/gw.py#L71-L72
I guess a PV could be lying about its type and is pushing out a integer instead.
These are internal status PVs. The types are not user determined. Most likely this is a case of my changing something about value conversions in PVXS, and not realizing the effect on P4P due to incomplete test coverage.