We're updating the issue view to help you get more done. 

Verify if there were packets pending to be sent and decide what to do with them

Description

Looks like someone was already planning this. Todo in the source: http://fisheye.igniterealtime.org/browse/openfire/trunk/src/java/org/jivesoftware/openfire/nio/ConnectionHandler.java?r1=12983&r2=12983&u=3#to138

There are ideas that this should help with messages being discarded while clients lose their connection.

This ticket needs better name and description.

Environment

None

Acceptance Test - Entry

None

Activity

Show:
Haohuan Li
March 22, 2013, 9:53 AM

I just looked into OpenFire source code v3.8.1. I found that the cause of the issue lies in the MINA lib that was reused by OpenFire. In NIOConnection.java, line 263:
http://fisheye.igniterealtime.org/browse/openfire/trunk/src/java/org/jivesoftware/openfire/nio/NIOConnection.java?r2=12983&u=3&r1=12983&r=13001

If the receiver is offline(while the server still assumes he is online), the code:

ioSession.write(buffer)

should have thrown an exception. But actually, no exception is thrown. The variable ioSession is an instance of class: org.apache.mina.common.IoSession, which is a component of Apache MINA project. Maybe this issue should be reported upwards to MINA project.

Daryl Herzmann
April 26, 2014, 6:59 PM

Hi Tom, You have any thoughts on this issue?

Tom Evans
April 26, 2014, 8:34 PM
Edited

Since we are using an asynchronous messaging model (via NIO), it makes sense to check whether the peer is still connected before attempting to send a packet. It appears this is what the underlying Mina implementation does, but because the NIOConnector does not wait to check the resulting WriteFuture instance, the backupDeliverer is not invoked (the IOException is effectively suppressed in another thread).

I can make the corresponding change, but note that this is a critical component of the Openfire engine and we will want to test thoroughly.

Tom Evans
April 26, 2014, 9:00 PM

Explicitly check the underlying connection and throw an IOException if the peer has dropped/reset the connection.

Assignee

Tom Evans

Reporter

wroot

Labels

None

Expected Effort

None

Components

Fix versions

Affects versions

Priority

Minor
Configure