python-varnishapi
python-varnishapi copied to clipboard
Reading from dump file leads to assert in vsm.c (varnishlog -r)
Issue: When attempting to use python-varnishapi to read varnishlog dumped to binary file on disk, opening it with Varnishapi.VarnishLog() triggers assert in vsm.c.
Assert error in VSM_Get(), vsm.c line 1019:
Condition((vd->attached) != 0) not true.
python-varnishapi from pypi, version 60.24. debian testing with Varnish 6.0.7 from packagecloud varnish60lts.
Using this snippet based on the examples:
#!/usr/bin/env python3
import varnishapi
from time import sleep
def cbline(vap, cbd, priv):
print(cbd)
def cbvxid(vap, priv):
print("VXID")
def cbgroup(vap, priv):
print("GROUP")
def main():
# vsl = varnishapi.VarnishLog(["-g", "request"])
vsl = varnishapi.VarnishLog(["-r", "foo.dump", "-g", "request"])
arg = {
"cb": cbline,
"vxidcb": cbvxid,
"groupcb": cbgroup,
"maxread": 0,
}
while 1:
ret = vsl.Dispatch(**arg)
if 0 == ret:
sleep(0.5)
print(".", end="")
vsl.Fini()
if __name__ == "__main__":
main()