I don't yet have a test case for the issues, but i have a description from a colleague in German under which circumstances this behavior occurs using Apache Mina 2.0.19:
- There must be multiple Threads (at least two) calling nearly simultaneously session.write and there must be multiple ProtocolCodecFilter in the FilterChain, whereas the first encoder doesn't produce messages of type IoBuffer - For example if thread A calls session.write and the first ProtocolCodecFilter has processed the write request, there will be an encoded message in the WriteRequestQueue of the session. Lets assume that it is an byte array. - Now if another thread B even called session.write in such circumstances that the call of thread B has passed all FilterChain and it is in progress to call AbstractPollingIoProcessor$Processor.flushNow(), the encoded message from thread A (which still is in process to complete FilterChain) result in the known error "Don't know how to handle message of type 'xyz'. Are you missing a protocol encoder?' - all following calls to session.write (regardless which thread) will even produce the error, because the following snippet (somewhere in mina): // Check for pending writes. req = session.getCurrentWriteRequest(); if (req == null) { req = writeRequestQueue.poll(session); if (req == null) { break; } session.setCurrentWriteRequest(req); } always return the same incomplete encoded message at line 'req = session.getCurrentWriteRequest();', because it isn't removed from initial first faulty processing. I hope someone understand whats going on, and if someone could tell me, if it is a bug in mina or a faulty usage of mina. best regards Max Larsson -- Sent from: http://apache-mina.10907.n7.nabble.com/Apache-MINA-User-Forum-f31345.html