I have an existing MINA application running under 1.1.7 and I'd really like to upgrade to to the 2.0 api (2.0.0-RC1).
After converting my application to use the new api's and wiring it up with the new components in my spring config I'm seeing some strange behavior with message ordering. My application consists of a client/server protocol that allows a client to connect and run a message exchange. The client can both send messages to the server (in client mode) and then switch modes to act as the server (receiver) and receive any messages queued for it. Many of the protocol messages are simple state change messages (one byte). The server only responds to incoming messages (actions are generally client initiated). In the old (1.1.7) version of MINA I'd see a message exchange like this: client--(start session)-->server client<--(start session response(accept))--server client--(initiate send data)-->server server<--(initiate send data ack)--server client--(send data)-->server client<--(send data ack(guid))--server ...(additional send data cycles) client--(terminate send data)-->server client<--(terminate send data ack)--server client--(terminate session)-->server client<--(terminate session ack)--server (disconnect) In the new version, occasionally I see strange sequences (and missing writes from the server) like this: client--(start session)-->server client<--(start session response(accept))--server client--(initiate send data)-->server server<--(initiate send data ack)--server client--(send data)-->server client<--(send data ack(guid))--server ...(additional send data cycles) client--(terminate send data)-->server client--(terminate session)-->server client<--(terminate send data ack)--server (disconnect) Here you can see that the server (appears to) receive two messages from the client (terminate send data, terminate session) back to back before the server sends the (terminate send data ack) message. However, this is impossible in the protocol. The client will only send the terminate session after receiving the ack from the (terminate send data) message from the server. Clearly the client received the (terminate send data ack) message before the client sent the (terminate session) message but for some reason the callback to the session for the sent event happens AFTER the receive of the new message. In some cases, the (terminate session ack) message never shows up in the logs (from the session write event) even though I'm doing a session.close(false) in the handler when I receive the (terminate session) message AFTER writing the (terminate session ack) to the session. I've tried several different approaches to configuring the threading model (multiple threads in the acceptor and an executor filter) in 2.0.0-RC1 but I still cannot be the same behavior as I had in 1.1.7. Can anyone shed some light on this? I was excited to finally upgrade to 2.x but I'm not willing to put back the refactored code until/unless I can fix/explain this different behavior. Thanks in advance, Charles
