Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-6145

Unbound SocketChannels do not correctly register with SocketBindingManager

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 19.0.1.Final, 20.0.0.Beta4
    • 19.0.0.Final, 20.0.0.Beta3
    • Server
    • None

    Description

      Consider the following code:

      InetSocketAddress bindAddress = ...;
      SocketBindingManager manager = ...;
      SocketChannel channel = SocketChannel.open();
      // channel is not yet bound
      manager.getNamedRegistry().registerChannel("foo", channel);
      // Bind channel
      channel.bind(bindAddress);
      System.out.println(manager.getManagedBinding("foo").getBindAddress());
      

      Ideally, this would print the value of the bindAddress of the channel, however, it returns null.

      This is because the registry reads the bind address eagerly, so if the channel is not bound until after it is registered, its ManagedBinding will never return the correct value.

      This is problematic for JGroups, whose SocketFactory (that instruments socket binding manager registration) returns unbound channels.

      Attachments

        Issue Links

          Activity

            Public project attachment banner

              context keys: [headless, issue, helper, isAsynchronousRequest, project, action, user]
              current Project key: WFCORE

              People

                pferraro@redhat.com Paul Ferraro
                pferraro@redhat.com Paul Ferraro
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: