Skip to content

Test_FinalInstanceState_2 conflicts with DDS default autodispose_unregistered_instances=true #92

Description

@simpsont-oci

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:

  1. 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.
  2. 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.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions