[ 
https://issues.apache.org/jira/browse/DIRMINA-1169?focusedWorklogId=813939&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-813939
 ]

ASF GitHub Bot logged work on DIRMINA-1169:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Oct/22 19:55
            Start Date: 05/Oct/22 19:55
    Worklog Time Spent: 10m 
      Work Description: tomaswolf commented on PR #35:
URL: https://github.com/apache/mina/pull/35#issuecomment-1264660539

   @elecharny could you please take look and merge this if you think it's OK? 
And then merge or cherry-pick it to the 2.1.X and 2.2.X branches? I'm a bit 
confused by the git history of this repo, and it's not clear to me how you 
manage back-ports or fixes in old versions, otherwise I might be able to do so 
myself. The three 2.* branches seem to be completely separate. That's not what 
I'm used to from EGit or JGit, where after a fix on an old maintenance branch 
we merge the change up to the current master/main branch.
   
   Having a 2.0.24 including the fix would also be useful. Currently we have 
disabled one test in Apache MINA sshd because of this problem.




Issue Time Tracking
-------------------

    Worklog Id:     (was: 813939)
    Time Spent: 0.5h  (was: 20m)

> BindException on Java >= 11 due to race condition in AbstractPollingIoAcceptor
> ------------------------------------------------------------------------------
>
>                 Key: DIRMINA-1169
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1169
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.23, 2.1.6, 2.2.1
>            Reporter: Thomas Wolf
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> See also SSHD-1256.
> The main acceptor loop does basically (somewhat simplified):
> {code:java}
> while (selectable) {
>   registerHandles(); // Process registration queue: add new sockets (from 
> bind()) to the selector with OP_ACCEPT, fulfills their open futures
>   int selected = select();
>   if (/* nothing to do */) {
>     break; // and end the thread; higher layers will create a new one if 
> needed
>   }
>   if (selected > 0) {
>     processHandles(selectedHandles()); // Handle and hand off new connections
>   }
>   unregisterHandles(); // Process cancel queue: cancel SelectionKey, close 
> ServerSocketChannel, fulfill the cancel future
> }
> {code}
> With Java 11, unbinding a {{ServerSocketChannel}} changed:
>  * [JDK-8214430|https://bugs.openjdk.org/browse/JDK-8214430]
>  * [Java 11 Release 
> Notes|https://www.oracle.com/java/technologies/javase/11-relnote-issues.html#JDK-8198562]
> Essentially the unbind gives up the socket only at the next {{select()}} 
> call. This causes two problems in Apache MINA's acceptor:
> * The unbind future is set "done" before the socket is actually released.
> * If a new binding for one of the unbound sockets is registered before that 
> {{select()}} has been done, {{registerHandles()}} gets a {{BindException}} 
> ("address already in use").
> So for Java >= 11, the code must ensure that there is a {{select()}} between 
> processing unbindings and processing new bindings, and the unbind futures 
> must be set "done" only after that {{select()}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to