OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

mqtt-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: Lifetime of topic alias map


Hi,

I noticed that if topic alias map is a part of the session state, then
implementing broker cluster would become very difficult.
So as the spec said, the topic alias map should be cleared when the
connection is disconnected.

I think that the spec should define clearer the behavior retrying a
publish message that has empty topic name and Topic Alias Property

At the following chapter,

4.4 Message delivery retry
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901238

I propose adding the clause is something like as follows:

When resending the publish packet that has an empty topic message and
Topic Alias property, the empty topic name must be replaced with the
topic name that is corresponding to the Topic Alias at the first
sending.

NOTE: That means changing meaning from **use topic alias** to
**register topic alias**.

MQTT client needs to implement the replacement logic. It can avoid
infinity protocol error and reconnecting loop.

---
Thanks,
Takatoshi

On Wed, Sep 2, 2020 at 10:09 AM Takatoshi Kondo <redboltz@gmail.com> wrote:
>
> On Fri, Aug 14, 2020 at 1:53 PM 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 ?
>
> According to the spec,  DISCONNECT with Reason Code of 0x82 (Protocol
> Error) should happen.
>
> See
>
> ---
> https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901120
>
> 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.
> ---
>
> That indicates that re-send and disconnect happen again and again if
> Topic Alias map lifetime lasts only for the lifetime of that Network
> Connection.
> If Topic Alias map lifetime lasts the same as session lifetime, the
> re-send won't cause DISCONNECT.
>
> ---
> Thanks,
> Takatoshi
>
> >
> > 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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]