Test_FinalInstanceState_2 currently expects NOT_ALIVE_NO_WRITERS_INSTANCE_STATE when a publisher finishes without explicitly unregistering or disposing instances:
'Test_FinalInstanceState_2' : {
'apps' : ['-P -t Square --num-iterations 200 --num-instances 4',
'-S -t Square'],
'expected_codes' : [ReturnCode.OK, ReturnCode.OK],
'check_function' : tsf.test_unregistering_w_instances,
}
However, this appears to conflict with the DDS/DCPS specification when the DataWriter uses the default WRITER_DATA_LIFECYCLE QoS.
DDS 1.4, section 2.2.3.21, WRITER_DATA_LIFECYCLE, defines autodispose_unregistered_instances. The spec says:
autodispose_unregistered_instances = TRUE causes the DataWriter to dispose the instance each time it is unregistered.
- This behavior is identical to explicitly calling
dispose before unregister_instance.
- Deletion of a DataWriter automatically unregisters all data-instances it manages.
- Therefore, the value of
autodispose_unregistered_instances determines whether instances are ultimately disposed when the DataWriter is deleted.
The QoS table for WRITER_DATA_LIFECYCLE also gives the default value of autodispose_unregistered_instances as TRUE.
Given those rules, if a publisher finishes cleanly and its DataWriter is deleted with the default autodispose_unregistered_instances=true, the subscriber should be allowed, and arguably expected, to observe
NOT_ALIVE_DISPOSED_INSTANCE_STATE, not NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.
This is what OpenDDS produces in an OpenDDS publisher -> OpenDDS subscriber run:
Test_FinalInstanceState_0: explicit unregister passes and produces NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.
Test_FinalInstanceState_1: explicit dispose passes and produces NOT_ALIVE_DISPOSED_INSTANCE_STATE.
Test_FinalInstanceState_2: no explicit final-state option produces NOT_ALIVE_DISPOSED_INSTANCE_STATE, but the test expects NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.
Possible fixes:
- Change
Test_FinalInstanceState_2 to expect NOT_ALIVE_DISPOSED_INSTANCE_STATE, since the current publisher command does not override the DDS default autodispose_unregistered_instances=true.
- Add a shape_main option to explicitly configure
WRITER_DATA_LIFECYCLE.autodispose_unregistered_instances, then split this into two tests:
autodispose_unregistered_instances=true: publisher deletion/finalization should result in NOT_ALIVE_DISPOSED_INSTANCE_STATE.
autodispose_unregistered_instances=false: publisher deletion/finalization should result in NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.
- If the intent of the existing test is specifically to test
NO_WRITERS, update the publisher setup so it explicitly sets autodispose_unregistered_instances=false.
My slight preference is option 2. It would make the lifecycle behavior under test explicit, cover both spec-defined cases, and avoid treating a spec-compliant DISPOSED result under the default QoS as an interoperability failure.
Test_FinalInstanceState_2currently expectsNOT_ALIVE_NO_WRITERS_INSTANCE_STATEwhen a publisher finishes without explicitly unregistering or disposing instances:However, this appears to conflict with the DDS/DCPS specification when the DataWriter uses the default
WRITER_DATA_LIFECYCLEQoS.DDS 1.4, section 2.2.3.21,
WRITER_DATA_LIFECYCLE, definesautodispose_unregistered_instances. The spec says:autodispose_unregistered_instances=TRUEcauses the DataWriter to dispose the instance each time it is unregistered.disposebeforeunregister_instance.autodispose_unregistered_instancesdetermines whether instances are ultimately disposed when the DataWriter is deleted.The QoS table for WRITER_DATA_LIFECYCLE also gives the default value of
autodispose_unregistered_instancesasTRUE.Given those rules, if a publisher finishes cleanly and its DataWriter is deleted with the default
autodispose_unregistered_instances=true, the subscriber should be allowed, and arguably expected, to observeNOT_ALIVE_DISPOSED_INSTANCE_STATE, notNOT_ALIVE_NO_WRITERS_INSTANCE_STATE.This is what OpenDDS produces in an OpenDDS publisher -> OpenDDS subscriber run:
Test_FinalInstanceState_0: explicit unregister passes and producesNOT_ALIVE_NO_WRITERS_INSTANCE_STATE.Test_FinalInstanceState_1: explicit dispose passes and producesNOT_ALIVE_DISPOSED_INSTANCE_STATE.Test_FinalInstanceState_2: no explicit final-state option producesNOT_ALIVE_DISPOSED_INSTANCE_STATE, but the test expectsNOT_ALIVE_NO_WRITERS_INSTANCE_STATE.Possible fixes:
Test_FinalInstanceState_2to expectNOT_ALIVE_DISPOSED_INSTANCE_STATE, since the current publisher command does not override the DDS defaultautodispose_unregistered_instances=true.WRITER_DATA_LIFECYCLE.autodispose_unregistered_instances, then split this into two tests:autodispose_unregistered_instances=true: publisher deletion/finalization should result inNOT_ALIVE_DISPOSED_INSTANCE_STATE.autodispose_unregistered_instances=false: publisher deletion/finalization should result inNOT_ALIVE_NO_WRITERS_INSTANCE_STATE.NO_WRITERS, update the publisher setup so it explicitly setsautodispose_unregistered_instances=false.My slight preference is option 2. It would make the lifecycle behavior under test explicit, cover both spec-defined cases, and avoid treating a spec-compliant
DISPOSEDresult under the default QoS as an interoperability failure.