[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [mqtt-comment] Lifetime of topic alias map
Hi Takatoshi, The key point is this section from the specification, which you did highlight: Topic Alias mappings exist only within a Network Connection and last only for the lifetime of that Network Connection. A receiver MUST NOT carry forward any Topic Alias mappings from one Network Connection to another [MQTT-3.3.2-7]. You ask about the following scenario: 5. Disconnect between the client and the broker. Broker clears the map here. 6. Client connects to the broker with CleanStart: false SessionExpiryInterval=0xfffffffff(infinity) 7. Client publishes empty topic with TopicAlias: 1, QoS: 1, PacketId:2 (PUBACK PacketId: 2 is not received so resend step 3 message) In this scenario, the client does not conform to the specification because it has kept its topic alias mapping beyond the life of the network connection. As soon as it disconnected, the mapping should have been deleted. If a client does send a PUBLISH message with an empty topic and a topic alias set, but there is no mapping for this topic alias, as above, then this part of section 3.3.4 applies: 3) If the receiver does not already have a mapping for this Topic Alias a) If the packet has a zero length Topic Name field it is a Protocol Error and the receiver uses DISCONNECT with Reason Code of 0x82 (Protocol Error) as described in section 4.13. Regards, Roger On Fri, 14 Aug 2020 at 05:54, Takatoshi Kondo <redboltz@gmail.com> wrote: > > Hi, > > I have a question about the lifetime of TopicAlias map. > > According to https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Topic_Alias > > > Topic Alias mappings exist only within a Network Connection and last only for the lifetime of that Network Connection. > > It seems that the lifetime of the map is over when the network > connection is closed. > > Consider the following scenario. > > 1. Client connects to the broker with CleanStart: false > SessionExpiryInterval=0xfffffffff(infinity) > 2. Client publishes topic1 with TopicAlias: 1, QoS: 1, PacketId: 1 > Broker inserts topic1 - ToppicAlias 1 entry to the map. > 3. Client publishes empty topic with TopicAlias: 1, QoS: 1, PacketId: 2 > Broker finds topic1 from the map using TopicAlias 1 as the key. > 4. Client receives PUBACK PacketId: 1. > 5. Disconnect between the client and the broker. Broker clears the map here. > 6. Client connects to the broker with CleanStart: false > SessionExpiryInterval=0xfffffffff(infinity) > 7. Client publishes empty topic with TopicAlias: 1, QoS: 1, PacketId: > 2 (PUBACK PacketId: 2 is not received so resend step 3 message) > 8. Broker can't find the topic corresponding to the TopicAlias: 1 in > the map because the map has been cleared at the step 5. > What should happen here? Should the broker disconnect the client > due to no matching TopicAlias with empty TopicName ? > > If the client continues to re-connect with the same parameter, the > publish packet at the step 3 is never processed by the broker. > The client needs to set CleanStart: true to erase re-send publish > message. But it avoids message deliverty guarantee. > > I think that if the lifetime of the map is the same as session > lifetime, it is easy to use. > At the step 5, broker dossn't clear the map. The lifetime of the map > is extended until the session lifetime is over. > > However, session is defined as follows: > > https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc473619931 > > > A stateful interaction between a Client and a Server. Some Sessions last only as long as the Network Connection, others can span multiple consecutive Network Connections between a Client and a Server. > > It seems ttat Network Connection and session are different concept. > > I think that TopicAlias mapping should have the same lifetime as the > session lifetime. > > Any ideas? > > ---- > Thanks, > Takatoshi > > -- > This publicly archived list offers a means to provide input to the > OASIS Message Queuing Telemetry Transport (MQTT) TC. > > In order to verify user consent to the Feedback License terms and > to minimize spam in the list archive, subscription is required > before posting. > > Subscribe: mqtt-comment-subscribe@lists.oasis-open.org > Unsubscribe: mqtt-comment-unsubscribe@lists.oasis-open.org > List help: mqtt-comment-help@lists.oasis-open.org > List archive: http://lists.oasis-open.org/archives/mqtt-comment/ > Feedback License: http://www.oasis-open.org/who/ipr/feedback_license.pdf > List Guidelines: http://www.oasis-open.org/maillists/guidelines.php > Committee: http://www.oasis-open.org/committees/mqtt > Join OASIS: http://www.oasis-open.org/join/ >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]