[ https://issues.apache.org/jira/browse/DIRMINA-1154 ]


    Emmanuel Lécharny deleted comment on DIRMINA-1154:
    --------------------------------------------

was (Author: elecharny):
Plain normal. The default object size is set to 1MB:

{code:java}
public class ObjectSerializationDecoder extends CumulativeProtocolDecoder {
    private final ClassLoader classLoader;

    private int maxObjectSize = 1048576; // 1MB

...
}
{code}

This can be changed by calling the ```setDecoderMaxObjectSize(int 
maxObjectSize)``` method in your init code:

{code:java}
...
        chain.addLast("mdc", mdcInjectionFilter);
        ObjectSerializationCodecFactory factory = new 
ObjectSerializationCodecFactory();
        factory.setDecoderMaxObjectSize( <the desired limit> );
        chain.addLast("codec", new ProtocolCodecFilter(factory));
...

{code}




> MINA: ProtocolDecoderException:BufferDataException for data size greater than 
> 1MB
> ---------------------------------------------------------------------------------
>
>                 Key: DIRMINA-1154
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1154
>             Project: MINA
>          Issue Type: Bug
>          Components: Core, Handler
>    Affects Versions: 2.0.19
>            Reporter: Saravanan
>            Priority: Major
>
> When data size greater than *1 MB* is written to the connection, error is 
> thrown at the receiver side while decoding.
> Following are the details:
> Mina version:
> mina-core-2.0.19.jar
> Server code snippet:
>         IoAcceptor acceptor = new NioSocketAcceptor();
>         DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
>         LoggingFilter loggingFilter = new LoggingFilter();
>         loggingFilter.setMessageSentLogLevel(LogLevel.DEBUG);
>         loggingFilter.setMessageReceivedLogLevel(LogLevel.DEBUG);
>         loggingFilter.setSessionClosedLogLevel(LogLevel.DEBUG);
>         loggingFilter.setSessionCreatedLogLevel(LogLevel.DEBUG);
>         loggingFilter.setSessionIdleLogLevel(LogLevel.DEBUG);
>         loggingFilter.setSessionOpenedLogLevel(LogLevel.DEBUG);
>         chain.addLast("logger", loggingFilter);
>         MdcInjectionFilter mdcInjectionFilter = new MdcInjectionFilter();
>         chain.addLast("mdc", mdcInjectionFilter);
>         chain.addLast("codec", new ProtocolCodecFilter(new 
> ObjectSerializationCodecFactory()));
> Client code snippet:
>         NioSocketConnector connector = new NioSocketConnector();
>         LoggingFilter LOGGING_FILTER = new LoggingFilter("MinaLogging");
>         LOGGING_FILTER.setMessageSentLogLevel(LogLevel.DEBUG);
>         LOGGING_FILTER.setMessageReceivedLogLevel(LogLevel.DEBUG);
>         
>         IoFilter CODEC_FILTER = new ProtocolCodecFilter(new 
> ObjectSerializationCodecFactory());
>         connector.getFilterChain().addLast("mdc", new MdcInjectionFilter());
>         connector.getFilterChain().addLast("codec", CODEC_FILTER);
>         connector.getFilterChain().addLast("logger", LOGGING_FILTER);
> Exception:
> org.apache.mina.filter.codec.ProtocolDecoderException: 
> org.apache.mina.core.buffer.BufferDataException: dataLength: 1048985 
> (Hexdump: XX...)
> at 
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:262)
>  [mina-core-2.0.19.jar:?]
> at 
> org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:180)
>  ~[mina-core-2.0.19.jar:?]
> at 
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:253)
>  ~[mina-core-2.0.19.jar:?]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to