Uploaded image for project: 'JBoss Remoting (3+)'
  1. JBoss Remoting (3+)
  2. REM3-122

Remoting hangs if client tries to connect before server creates server

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.2.0.Beta3
    • 3.2.0.Beta2
    • None

    Description

      The following change to the setup of RemoteChannelTest shows the problem, there is a delay before the server is installed and the client tries to connect in the meantime.

      $git diff
      diff --git a/src/test/java/org/jboss/remoting3/test/RemoteChannelTest.java b/src/test/java/org/jboss/remoting3/test/RemoteChannelTest.java
      index 38d6295..3e3509a 100644
      --- a/src/test/java/org/jboss/remoting3/test/RemoteChannelTest.java
      +++ b/src/test/java/org/jboss/remoting3/test/RemoteChannelTest.java
      @@ -58,27 +58,44 @@ import org.xnio.channels.ConnectedStreamChannel;
       
       /**
        * Test for remote channel communication.
      - * 
      + *
        * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
        */
       public final class RemoteChannelTest extends ChannelTestBase {
           protected static Endpoint endpoint;
           protected static ExecutorService executorService;
      -    private static AcceptingChannel<? extends ConnectedStreamChannel> streamServer;
      +    private static volatile AcceptingChannel<? extends ConnectedStreamChannel> streamServer;
           private static Registration registration;
           private Connection connection;
           private Registration serviceRegistration;
       
           @BeforeClass
      -    public static void create() throws IOException {
      +    public static void create() throws IOException, InterruptedException {
               executorService = new ThreadPoolExecutor(16, 16, 1L, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>());
               endpoint = Remoting.createEndpoint("test", executorService, OptionMap.EMPTY);
               Xnio xnio = Xnio.getInstance();
               registration = endpoint.addConnectionProvider("remote", new RemoteConnectionProviderFactory(xnio), OptionMap.create(Options.SSL_ENABLED, Boolean.FALSE));
      -        NetworkServerProvider networkServerProvider = endpoint.getConnectionProviderInterface("remote", NetworkServerProvider.class);
      -        SimpleServerAuthenticationProvider provider = new SimpleServerAuthenticationProvider();
      +        final NetworkServerProvider networkServerProvider = endpoint.getConnectionProviderInterface("remote", NetworkServerProvider.class);
      +        final SimpleServerAuthenticationProvider provider = new SimpleServerAuthenticationProvider();
               provider.addUser("bob", "test", "pass".toCharArray());
      -        streamServer = networkServerProvider.createServer(new InetSocketAddress("::1", 30123), OptionMap.create(Options.SASL_MECHANISMS, Sequence.of("CRAM-MD5")), p
      +        
      +        Thread t = new Thread(new Runnable() {
      +            
      +            @Override
      +            public void run() {
      +                try {
      +                    Thread.sleep(2000);
      +                    streamServer = networkServerProvider.createServer(new InetSocketAddress("::1", 30123), OptionMap.create(Options.SASL_MECHANISMS, Sequence.of("CR
      +                } catch (InterruptedException e) {
      +                    // AutoGenerated
      +                    throw new RuntimeException(e);
      +                } catch (IOException e) {
      +                    // AutoGenerated
      +                    throw new RuntimeException(e);
      +                }
      +            }
      +        });
      +        t.start();
           }
       
           @Before
      

      The full file has been attached.

      Attachments

        Issue Links

          Activity

            People

              dlloyd@redhat.com David Lloyd
              kkhan1@redhat.com Kabir Khan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: