You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Martyn Taylor (JIRA)" <ji...@apache.org> on 2016/06/08 12:54:21 UTC

[jira] [Closed] (ARTEMIS-509) Artemis MQTT doesnt respect MQTT Client's connect keepalive. It disconnects at 0.75 time of the requested keepalive

     [ https://issues.apache.org/jira/browse/ARTEMIS-509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martyn Taylor closed ARTEMIS-509.
---------------------------------

> Artemis MQTT doesnt respect MQTT Client's connect keepalive. It disconnects at 0.75 time of the requested keepalive
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-509
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-509
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 1.2.0
>            Reporter: Diego Bes
>
> on MQTTProtocolHandler.java the server creates a ttl of 3/4 of the time set by the keepalive sent by the client.
> With this setting, the server will always disconnect the connection before the client can even send a PING packet.
> From the specs, the server should wait 1.5 times the time set by the client's connect KeepAlive and not 0.75 times
> ( If the Keep Alive value is non-zero and the Server does not receive a Control Packet from the Client within one and a half times the Keep Alive time period, it MUST disconnect the Network Connection to the Client as if the network had failed [MQTT-3.1.2-24]. )
> ( link to the git code https://github.com/apache/activemq-artemis/blob/master/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java#L159 )
> The following code:
> {code}
> /**
>     * Called during connection.
>     *
>     * @param connect
>     */
>    void handleConnect(MqttConnectMessage connect, ChannelHandlerContext ctx) throws Exception {
>       this.ctx = ctx;
>       connectionEntry.ttl = connect.variableHeader().keepAliveTimeSeconds() * 750;
>       String clientId = connect.payload().clientIdentifier();
>       session.getConnectionManager().connect(clientId, connect.payload().userName(), connect.payload().password(), connect.variableHeader().isWillFlag(), connect.payload().willMessage(), connect.payload().willTopic(), connect.variableHeader().isWillRetain(), connect.variableHeader().willQos(), connect.variableHeader().isCleanSession());
>    }
> {code} 
> Should look like:
> {code}
> /**
>     * Called during connection.
>     *
>     * @param connect
>     */
>    void handleConnect(MqttConnectMessage connect, ChannelHandlerContext ctx) throws Exception {
>       this.ctx = ctx;
>       connectionEntry.ttl = connect.variableHeader().keepAliveTimeSeconds() * 1500;
>       String clientId = connect.payload().clientIdentifier();
>       session.getConnectionManager().connect(clientId, connect.payload().userName(), connect.payload().password(), connect.variableHeader().isWillFlag(), connect.payload().willMessage(), connect.payload().willTopic(), connect.variableHeader().isWillRetain(), connect.variableHeader().willQos(), connect.variableHeader().isCleanSession());
>    }
> {code}
> Where the ttl is set to keepalive * 1500 ( keepalive is in seconds ) 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)