[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2018-02-09 Thread Jonathan Valliere (JIRA)

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

Jonathan Valliere commented on DIRMINA-1060:


Emmanuel, I think you can close this ticket since the patch was applied.

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
>Priority: Major
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



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


Re: [jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Jonathan Valliere
IMHO the Connector is like creating a FileOutputStream or FileChannel;
trying to open them and hitting the ulimit throws an Exception to the code
trying to open.  The difference between Acceptor and Connector is that the
Acceptor is an automated process as part of the framework and not user-code.

On Fri, Oct 27, 2017 at 10:18 AM, Emmanuel Lécharny 
wrote:

>
>
> Le 27/10/2017 à 15:58, Jonathan Valliere a écrit :
> > For connector, I would allow the error to flow all the way up the stack.
>
> Currently, the excption is caught, a Thread.sleep(1000) is called, and
> the ExceptionMonitor.exceptionCaught() method is called.
>
> --
> Emmanuel Lecharny
>
> Symas.com
> directory.apache.org
>
>


Re: [jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Emmanuel Lécharny


Le 27/10/2017 à 15:58, Jonathan Valliere a écrit :
> For connector, I would allow the error to flow all the way up the stack.

Currently, the excption is caught, a Thread.sleep(1000) is called, and
the ExceptionMonitor.exceptionCaught() method is called.

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org



Re: [jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Jonathan Valliere
For connector, I would allow the error to flow all the way up the stack.

On Fri, Oct 27, 2017 at 9:56 AM Emmanuel Lecharny (JIRA) 
wrote:

>
> [
> https://issues.apache.org/jira/browse/DIRMINA-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16222402#comment-16222402
> ]
>
> Emmanuel Lecharny commented on DIRMINA-1060:
> 
>
> I have applied the patch with some log and comments :
> http://git-wip-us.apache.org/repos/asf/mina/commit/2494b787
>
> Not sure it's critical for {{Connector}}
>
> > Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> > ---
> >
> > Key: DIRMINA-1060
> > URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> > Project: MINA
> >  Issue Type: Bug
> >Affects Versions: 2.0.16
> >Reporter: Emmanuel Lecharny
> > Fix For: 2.0.17
> >
> >
> > We have a workaround for the selector spinning issue in NioProcessor, we
> need to use it for the Acceptor/Connector Datagram/Socket implementation
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.4.14#64029)
>


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Emmanuel Lecharny (JIRA)

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

Emmanuel Lecharny commented on DIRMINA-1060:


I have applied the patch with some log and comments : 
http://git-wip-us.apache.org/repos/asf/mina/commit/2494b787

Not sure it's critical for {{Connector}}

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Emmanuel Lecharny (JIRA)

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

Emmanuel Lecharny commented on DIRMINA-1060:


Actually, this is quite smart. You create some 'contention' on the server, 
which is anyway incapable of accepting anymore incoming connection.

This is a brutal, but efficient workaround. I'll add that to the code, and also 
generate some log when we get an exception.

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Jonathan Valliere (JIRA)

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

Jonathan Valliere commented on DIRMINA-1060:


Correct, its a work around.  There is no practical way of preventing the 
spinning without the {{thread.sleep}}.  This method allows the currently 
connected sockets to continue to operate normally until new sockets can be 
accepted otherwise the {{Acceptor}} will spin as fast as possible and eat an 
entire core.  If you had 2-3 {{Acceptors}} and 4 cores, that might be a problem.

I thought that condition was the basis for this bug.  I thought there was some 
mention of unlimit spinning in the mailing list a while back and put the two 
together.

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Emmanuel Lecharny (JIRA)

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

Emmanuel Lecharny commented on DIRMINA-1060:


Ok, I see haw the {{select()}} can become crazy in this case.

Now, how can a simple {{thread.sleep()}} help in this situation ? At best, it's 
a workaround, and only if some socket get freed and become available, no ? Just 
wondering...

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-27 Thread Jonathan Valliere (JIRA)

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

Jonathan Valliere commented on DIRMINA-1060:


Sorry, handle = File Handle = File Descriptor

When reaching the ulimit, the Acceptor will spin out of control.  This stops it.

{code:java}
protected java.nio.channels.SocketChannel accept(ServerSocketChannel value) 
throws IOException
{
try
{
return value.accept();
}
catch (Throwable x)
{
//  log.error("Error Calling Accept on Socket - 
Sleeping Acceptor Thread", x);

try
{
Thread.sleep(50);
}
catch (InterruptedException e)
{

}
}

return null;
}
{code}


> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-26 Thread Emmanuel Lecharny (JIRA)

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

Emmanuel Lecharny commented on DIRMINA-1060:


What do you mean by 'out of handle' ? Like when you have reach {{ulimit}} on 
linux ?

In {{NIO}}, we never call the {{accept()}} method explicitely, we register some 
interest on the {{OP_ACCEPT}} event and get woke up when it happens, which 
means that the {{select()}} call will return and we will be able to process the 
accepted connection.

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-26 Thread Jonathan Valliere (JIRA)

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

Jonathan Valliere commented on DIRMINA-1060:


For TCP connections `accept()` throws an `Exception` when out of handles.  What 
I did in the other framework was to capture that `Exception` and sleep the 
`Thread` for 1ms.

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-26 Thread Emmanuel Lecharny (JIRA)

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

Emmanuel Lecharny commented on DIRMINA-1060:


For {{Datagram}}, I don't think it makes any sense : we are not keeping any 
{{selectionKey}}, it's not going to loop.

For the {{Connector}} and {{Acceptor}}, we still need to add the logic. The 
{{Acceptor}} should not be an issue, as it's only waiting for {{OP_ACCEPT}} and 
once handled, the control is passed to the {{IoProcessor}}



> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DIRMINA-1060) Handle the spinning selectors in Socket/Datagram Acceptor and Connector

2017-10-13 Thread Jonathan Valliere (JIRA)

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

Jonathan Valliere commented on DIRMINA-1060:


Emmanuel, is this resolved?

> Handle the spinning selectors in Socket/Datagram Acceptor and Connector
> ---
>
> Key: DIRMINA-1060
> URL: https://issues.apache.org/jira/browse/DIRMINA-1060
> Project: MINA
>  Issue Type: Bug
>Affects Versions: 2.0.16
>Reporter: Emmanuel Lecharny
> Fix For: 2.0.17
>
>
> We have a workaround for the selector spinning issue in NioProcessor, we need 
> to use it for the Acceptor/Connector Datagram/Socket implementation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)