馃敟 Quiddities are not destroyed
Summary
As reported by @ogauthier_sat, quiddities are not destroyed while destroying the switcher instance when Python exits.
I expect pyquid interface to clean-up quiddities and call each destructors when exiting.
This is problematic for SIP quiddity. When running SIP quiddity in switcher with switcher-ctrl interface, exiting switcher process correctly ends any on-going session and cleanly unregister from SIP server. When using SIP quiddity with pyquid interface, you end with stale calls and registrations if SIP life-cycle is not carefully managed by Python app.
How to reproduce ?
Start an sngrep session on workstation to observe SIP messages exchanged with server :
sudo apt install sngrep
sudo sngrep
Initialize a SIP quiddity, register to server, let Python interpreter exit from following script :
import pyquid
switcher = pyquid.Switcher('switcher', debug=True)
sip = switcher.create('sip', 'sip1')
sip.invoke('register', ['qasip1@dev.sip.scenic.sat.qc.ca', '<password>'])
In sngrep, last SIP message sent by SIP quiddity is REGISTER Expires: 300.
REGISTER sip:qasip1@dev.sip.scenic.sat.qc.ca SIP/2.0
[...]
Expires: 300
Expected behavior
The switcher instance along with initialized quiddities should be destroyed. SIP quiddity have its C++ destructor called and unregister itself from server.
I expect last message sent by SIP quiddity to be REGISTER Expire: 0 (Unregister).
Here's same test done with switcher-ctrl interface :
#!/bin/bash
switcher -d &
PID=$!
sleep 2
switcher-ctrl -C sip sip
switcher-ctrl -i sip register qasip2@dev.sip.scenic.sat.qc.ca <password>
sleep 2
kill -INT $PID
Last message on sngrep is SIP quiddity unregistering :
REGISTER sip:qasip2@dev.sip.scenic.sat.qc.ca SIP/2.0
[...]
Expires: 0
What is the frequency of occurrence of this behavior ?
Always.
Other comment
Only the reference to the switcher list attribute quiddities
is destroyed, quiddity instances still exists within Python.