[ 
https://issues.apache.org/jira/browse/DIRMINA-1085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16487694#comment-16487694
 ] 

Emmanuel Lecharny commented on DIRMINA-1085:
--------------------------------------------

Yep, this is a normal exception : we don't manage read/write suspend in 
{{UDP}}. Currently, that ends with this function :

{code:java}
public final class NioDatagramAcceptor extends AbstractIoAcceptor implements 
DatagramAcceptor, IoProcessor<NioSession> {
    ...
    public void updateTrafficControl(NioSession session) {
        throw new UnsupportedOperationException();
    }
    ...
{code}

which is called when calling :

{code:java}
public abstract class AbstractIoSession implements IoSession {
    ...
    public final void suspendRead() {
        readSuspended = true;
        if (isClosing() || !isConnected()) {
            return;
        }
        getProcessor().updateTrafficControl(this);
    }
    ...
{code}

There are three options here :
- don't call the {{suspendRead}} for {{UDP}} transport
- we make it so the {{NioDatagramAcceptor.updateTrafficControl}} don't throw an 
exception, but does nothing
- or we build a mechanism by which we simply don't read datagrams when 
{{suspenRead}} is called.

I guess the third option is the one you are interested in :-)



> Setting suspendRead on IoSession prevents new connections in shared 
> NioDatagramAcceptor
> ---------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-1085
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1085
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.17
>         Environment: Red5 Pro Server on Ubuntu
>            Reporter: Paul Gregoire
>            Priority: Major
>
> When using the ice4j library with integrated Mina 2.0.17, we have run into an 
> issue that is caused by our defensive action against browsers. The idea was 
> to suspendRead on the target IoSession when it was in the process of being 
> closed / cleaned up, but in doing so, the server can get in a bad state where 
> it no longer accepts connections. As seen in the log snipit below, 
> suspendRead on the IoSession causes a UOEx in the shared NioDatagramAcceptor; 
> "shared" being the operative word here. It would seem to us that acceptors 
> may be shared with impunity, if this is not the case, we can update ice4j to 
> prevent sharing. I'll add some test code if required, but for now, this is 
> what I have and here is the github location of our ice4j fork 
> [https://github.com/Red5/ice4j]
>  
> {{2018-05-23 14:31:00,433 [NioDatagramAcceptor-8] WARN 
> org.ice4j.ice.nio.IceHandler - Exception on 10.198.219.143:60515/udp}}
> {{org.apache.mina.filter.codec.ProtocolDecoderException: 
> java.lang.UnsupportedOperationException (Hexdump: 00 01 00 54 21 12 A4 42 4D 
> 57 6B 68 38 71 54 65 2F 51 70 51 00 06 00 13 61 6E 6E 64 6E 31 63 65 36 6D 68 
> 74 66 35 3A 77 47 6E 5A 00 C0 57 00 04 00 00 00 32 80 29 00 08 09 6C 92 9E 9D 
> BC 63 05 00 24 00 04 6E 00 1F 00 00 08 00 14 98 EC A7 54 01 47 86 DE FF 18 52 
> B5 59 74 A6 51 D9 C9 A1 C6 80 28 00 04 13 6F 2C F0)}}
> {{ at 
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:262)}}
> {{ at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:641)}}
> {{ at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)}}
> {{ at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1114)}}
> {{ at 
> org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:121)}}
> {{ at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:641)}}
> {{ at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:634)}}
> {{ at 
> org.apache.mina.transport.socket.nio.NioDatagramAcceptor.readHandle(NioDatagramAcceptor.java:306)}}
> {{ at 
> org.apache.mina.transport.socket.nio.NioDatagramAcceptor.processReadySessions(NioDatagramAcceptor.java:270)}}
> {{ at 
> org.apache.mina.transport.socket.nio.NioDatagramAcceptor.access$700(NioDatagramAcceptor.java:68)}}
> {{ at 
> org.apache.mina.transport.socket.nio.NioDatagramAcceptor$Acceptor.run(NioDatagramAcceptor.java:181)}}
> {{ at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)}}
> {{ at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)}}
> {{ at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)}}
> {{ at java.lang.Thread.run(Thread.java:748)}}
> {{Caused by: java.lang.UnsupportedOperationException: null}}
> {{ at 
> org.apache.mina.transport.socket.nio.NioDatagramAcceptor.updateTrafficControl(NioDatagramAcceptor.java:823)}}
> {{ at 
> org.apache.mina.transport.socket.nio.NioDatagramAcceptor.updateTrafficControl(NioDatagramAcceptor.java:68)}}
> {{ at 
> org.apache.mina.core.session.AbstractIoSession.suspendRead(AbstractIoSession.java:718)}}
> {{ at org.ice4j.ice.nio.IceDecoder.decode(IceDecoder.java:220)}}
> {{ at 
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:253)}}
> {{ ... 14 common frames omitted}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to