Indeed. But the point is that you can't fetch an available port and use it immediately and be sure it's not used by another process without some kind of global lock on your system...

I don't see any other way to grab an available port from the OS, and guarantee it's not used when you have to bind a socket on it and release it immediately for use by another socket.


Back to the issue: can you grab a StackTrace to see exactly where it blocks, in case there is another issue?

Many thanks!

On 11/10/2024 13:59, Gary Gregory wrote:
But it's not really doing that because it's NOT using the allocated ServerSocket. Once that method exists, any other process in the underlying OS can grab that port for itself.

Gary

On Fri, Oct 11, 2024, 7:53 AM Emmanuel Lécharny <elecha...@gmail.com <mailto:elecha...@gmail.com>> wrote:



    On 11/10/2024 10:01, Gary Gregory wrote:
     > Hi Emanuel,
     >
     > Why not use ephemeral ports?

    this is exactly what the AvailablePortFinder.getNextAvailable()
    method does:

          public static int getNextAvailable() {
              try (ServerSocket serverSocket = new ServerSocket(0)){
                  // Here, we simply return an available port found by
    the system
                  return serverSocket.getLocalPort();
              } catch (IOException ioe) {
                  throw new NoSuchElementException(ioe.getMessage());
              }


    It might mean a bit of work update the
     > tests to query the port and then use it, but it seems less probe to
     > problems. I'll try again in a few hours.
     >
     > Gary
     >
     > On Thu, Oct 10, 2024, 10:17 PM Emmanuel Lécharny
    <elecha...@gmail.com <mailto:elecha...@gmail.com>
     > <mailto:elecha...@gmail.com <mailto:elecha...@gmail.com>>> wrote:
     >
     >     Thanks Gary!
     >
     >     DIRMINA777Test may fell due to some port collision (we use a
     >     AvailablePortFinder.getNextAvailable() call to find a port
    that the
     >     Acceptor can use, but as some other tests may run
    concurrently, the
     >     same
     >     port can be in use by another Acceptor, and the readFuture
    can wait
     >     forever because the IoHandler that responds to connection is
    not doing
     >     what is expected.
     >
     >     It's not perfect, and the only solution is to run the test
    another time.
     >
     >     Could you give it another try?
     >
     >     Side note: the AvailablePortFinder.getNextAvailable() method,
    which is
     >     only used for tests, should probably be syncrhonized to avoid
    being
     >     called by many threads at the same time.
     >
     >     Thanks!
     >
     >     On 10/10/2024 15:10, Gary Gregory wrote:
     >      > + 1 Release MINA 2.1.9
     >      >
     >      > Release MINA 2.0.26: Running
     >      > org.apache.mina.transport.socket.nio.x hangs or takes
     >      > forever, I killed it after 30 minutes.
     >      >
     >      > - Tested the src ZIPs
     >      > - ASCs OK
     >      > - SHA512 files are not machine verifiable with `shasum
    --check`
     >     due to
     >      > their incompatible format.
     >      > - mvn clean verify
     >      > - Using:
     >      > openjdk version "11.0.24" 2024-07-16
     >      > OpenJDK Runtime Environment Homebrew (build 11.0.24+0)
     >      > OpenJDK 64-Bit Server VM Homebrew (build 11.0.24+0, mixed
    mode)
     >      >
     >      > Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
     >      > Maven home: /usr/local/Cellar/maven/3.9.9/libexec
     >      > Java version: 11.0.24, vendor: Homebrew, runtime:
     >      >
>  /usr/local/Cellar/openjdk@11/11.0.24/libexec/openjdk.jdk/Contents/Home
     >      > Default locale: en_US, platform encoding: UTF-8
     >      > OS name: "mac os x", version: "15.0.1", arch: "x86_64",
    family: "mac"
     >      >
     >      > Darwin **** 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24
     >     23:36:30 PDT
     >      > 2024; root:xnu-11215.1.12~1/RELEASE_X86_64 x86_64
     >      >
     >      > Gary
     >      >
     >      >
     >      > On Wed, Oct 9, 2024 at 10:53 AM Emmanuel Lécharny
     >     <elecha...@gmail.com <mailto:elecha...@gmail.com>
    <mailto:elecha...@gmail.com <mailto:elecha...@gmail.com>>
     >      > <mailto:elecha...@gmail.com <mailto:elecha...@gmail.com>
    <mailto:elecha...@gmail.com <mailto:elecha...@gmail.com>>>> wrote:
     >      >
     >      >     Hi!
     >      >
     >      >     I have started this vote 9 days ago, still haven't get any
     >     vote yet...
     >      >
     >      >     On 30/09/2024 19:21, Emmanuel Lecharny wrote:
     >      >      > hi!
     >      >      >
     >      >      > WARNING: there are 2 votes to cast!
     >      >      >
     >      >      >
     >      >      > This is a vote for a double release:
     >      >      > * MINA 2.1.9
     >      >      > * MINA 2.0.26
     >      >      >
     >      >      > Those versions are a maintenance realase, fixing a
    bug in
     >     the way we
     >      >      > treat Strings when reading a IoBuffer:
     >      >      >
     >      >      > DIRMINA-1181:Exception thrown when attempting to decode
     >     certain
     >      >     UTF-16 chars
     >      >      >
     >      >      >
     >      >      >
     >      >      > Temporary tags have been created (they can be
    removed if
     >     the vote
     >      >     is not
     >      >      > approved) :
     >      >      >
     >      >      > * MINA 2.1.9:
     >      >      >
     >      >
     >
    https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60 
<https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60> 
<https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60 
<https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60>> 
<https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60 
<https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60> 
<https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60 
<https://github.com/apache/mina/commit/8df31da1597056b73f5d6dbf11c75ce13227ba60>>>
     >      >      >
     >      >      > * MINA 2.0.26:
     >      >      >
     >      >
     >
    https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49 
<https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49> 
<https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49 
<https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49>> 
<https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49 
<https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49> 
<https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49 
<https://github.com/apache/mina/commit/4d1cf35024ae565827b63c11bd0b42a62a1c3e49>>>
     >      >      >
     >      >      >
     >      >      >
     >      >      >
     >      >      > The final artifacts are stored in a staging repository:
     >      >      > * MINA 2.1.9:
     >      >      >
     >      >
     >
    https://repository.apache.org/content/repositories/orgapachemina-1105 
<https://repository.apache.org/content/repositories/orgapachemina-1105> 
<https://repository.apache.org/content/repositories/orgapachemina-1105 
<https://repository.apache.org/content/repositories/orgapachemina-1105>> 
<https://repository.apache.org/content/repositories/orgapachemina-1105 
<https://repository.apache.org/content/repositories/orgapachemina-1105> 
<https://repository.apache.org/content/repositories/orgapachemina-1105 
<https://repository.apache.org/content/repositories/orgapachemina-1105>>>
     >      >      > * MINA 2.0.26:
     >      >      >
     >      >
     >
    https://repository.apache.org/content/repositories/orgapachemina-1104 
<https://repository.apache.org/content/repositories/orgapachemina-1104> 
<https://repository.apache.org/content/repositories/orgapachemina-1104 
<https://repository.apache.org/content/repositories/orgapachemina-1104>> 
<https://repository.apache.org/content/repositories/orgapachemina-1104 
<https://repository.apache.org/content/repositories/orgapachemina-1104> 
<https://repository.apache.org/content/repositories/orgapachemina-1104 
<https://repository.apache.org/content/repositories/orgapachemina-1104>>>
     >      >      >
     >      >      >
     >      >      >
     >      >      > The distributions are available for download on :
     >      >      > * MINA 2.1.9:
     >      > https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9>
     >     <https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9>>
>      >  <https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9>
     >     <https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.1.9>>>
     >      >      > * MINA 2.0.26:
     >      > https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26>
     >     <https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26>>
>      >  <https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26>
     >     <https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26
    <https://dist.apache.org/repos/dist/dev/mina/mina/2.0.26>>>
     >      >      >
     >      >      >
     >      >      > Let us vote :
     >      >      > [ ] +1 | Release MINA 2.1.9
     >      >      > [ ] ± | Abstain
     >      >      > [ ] -1 | Do *NOT* release MINA 2.1.9
     >      >      >
     >      >      >
     >      >      > [ ] +1 | Release MINA 2.0.26
     >      >      > [ ] ± | Abstain
     >      >      > [ ] -1 | Do *NOT* release MINA 2.0.26
     >      >      >
     >      >      >
     >      >      >
     >      >
     >      >     --
     >      >     *Emmanuel Lécharny* P. +33 (0)6 08 33 32 61
     >      > elecha...@apache.org <mailto:elecha...@apache.org>
    <mailto:elecha...@apache.org <mailto:elecha...@apache.org>>
     >     <mailto:elecha...@apache.org <mailto:elecha...@apache.org>
    <mailto:elecha...@apache.org <mailto:elecha...@apache.org>>>
     >      >
     >      >
>  ---------------------------------------------------------------------
     >      >     To unsubscribe, e-mail:
    dev-unsubscr...@mina.apache.org <mailto:dev-unsubscr...@mina.apache.org>
     >     <mailto:dev-unsubscr...@mina.apache.org
    <mailto:dev-unsubscr...@mina.apache.org>>
     >      >     <mailto:dev-unsubscr...@mina.apache.org
    <mailto:dev-unsubscr...@mina.apache.org>
     >     <mailto:dev-unsubscr...@mina.apache.org
    <mailto:dev-unsubscr...@mina.apache.org>>>
     >      >     For additional commands, e-mail:
    dev-h...@mina.apache.org <mailto:dev-h...@mina.apache.org>
     >     <mailto:dev-h...@mina.apache.org
    <mailto:dev-h...@mina.apache.org>>
     >      >     <mailto:dev-h...@mina.apache.org
    <mailto:dev-h...@mina.apache.org>
     >     <mailto:dev-h...@mina.apache.org
    <mailto:dev-h...@mina.apache.org>>>
     >      >
     >
     >     --
     >     *Emmanuel Lécharny* P. +33 (0)6 08 33 32 61
     > elecha...@apache.org <mailto:elecha...@apache.org>
    <mailto:elecha...@apache.org <mailto:elecha...@apache.org>>
     >

-- *Emmanuel Lécharny* P. +33 (0)6 08 33 32 61
    elecha...@apache.org <mailto:elecha...@apache.org>


--
*Emmanuel Lécharny* P. +33 (0)6 08 33 32 61
elecha...@apache.org

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

Reply via email to