Programs which seemed to work fine under 2.1.1 have strange problems under
2.1.2.  For example, the program below is a simple test program which
creates a connection and then destroys the connection.  Nothing else is
done.  Under 2.1.1 the program runs fine.  Under 2.1.2 the program never
exits.  It appears that the problem may be a swiftmq thread is hanging (see
the javacore details below).

I am not an expert at JMS or SwiftMQ (or even Java for that matter), so it
is possible there are errors in my code (masked by 2.1.1 bugs?).  I would
appreciate suggestions regarding the steps the code uses to connect and
disconnect from the router.

Any idea what is going on?  Has anyone else seen problems with 2.1.2?   Some
of my other programs under 2.1.2 appear to have problems which also seem to
be related to threads hanging (I see javacore output similar to what I show
below).

Thanks

  Geoffrey A. Lowney
  Senior Software Development Engineer
  Recreational Equipment, Inc.
  Phone 253-395-8164 Fax 253-437-7291
  Pager 206-625-8477 [EMAIL PROTECTED]
  [EMAIL PROTECTED] http://www.rei.com/

Here are the gory details of my test program and results...

JVM version: J2RE 1.2.2 IBM build ca122-19991217
OS Level   : AIX 4.3.3.0

Here is the output from the program.  It looks the same under 2.1.1 and
2.1.2.

  $ java com.rei.mom.ConnectTest    
  main: entering go
  main: entering connect
  main: creating Context
  main: Context created
  main: creating QueueConnectionFactory
  main: creating QueueConnection
  main: creating QueueSession
  main: creating Queue
  main: starting QueueConnection
  main: closing Context
  main: leaving connect
  main: entering disconnect
  main: closing QueueSession
  main: closing QueueConnection
  main: leaving disconnect
  main: leaving go
  $ 

Under 2.1.2, after the final message is displayed, I generated a javacore.
Here is the thread that appears to be hanging (its the only one in R state,
and the only one that references swiftmq):

    "Thread-0" (TID:0x80033668, stillborn, sys_thread_t:0x30522840, state:R,
native ID:0x405) prio=5: pending=java.lang.ThreadDeath
        at java.net.SocketInputStream.socketRead(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:98)
        at
java.io.BufferedInputStream.fill(BufferedInputStream.java(Compiled Code))
        at
java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled Code))
        at java.io.DataInputStream.readInt(DataInputStream.java(Compiled
Code))
        at
com.swiftmq.tools.dump.Dumpalizer.construct(Dumpalizer.java(Compiled Code))
        at
com.swiftmq.jms.ConnectionImpl.readObject(ConnectionImpl.java(Compiled
Code))
        at com.swiftmq.jms.ConnectionImpl.run(ConnectionImpl.java:424)
        at java.lang.Thread.run(Thread.java:481)
         ----- Native Stack -----
        merge_into_successors
        _pthread_event_wait
        _cond_wait_local
        _cond_wait
        pthread_cond_wait
        try_suspend
        realObjAlloc
        allocArray
        utf2JavaString
        jni_NewStringUTF
        jni_ThrowNew
        JNU_ThrowByName
        NET_ThrowNew
        NET_ThrowCurrent
        Java_java_net_SocketInputStream_socketRead
        mmisInvoke_OIIOO_IHelper
        entryCmp

Here is the test program (username, password and queuename removed):

///////////////////////////////////////////////////////////
package com.rei.mom;

import javax.jms.*;
import javax.naming.*;
import java.util.*;
import com.rei.mom.*;

public class ConnectTest {
  public static final String QUEUECONFAC = "QueueConnectionFactory";
  private String                    username = "******";
  private String                    password = "******";
  private String                    queueName = "*******";
  private Context                   jndiContext = null;
  private QueueConnectionFactory    queueConnectionFactory = null;
  private QueueConnection           queueConnection = null;
  private QueueSession              queueSession = null;
  private Queue                     queue = null;

  public static void main(String[] args) {
    ConnectTest test = new ConnectTest();
    test.go();
  }

  public void go() {
    System.out.println(Thread.currentThread().getName() + ": entering go");
    connect();
    disconnect();
    System.out.println(Thread.currentThread().getName() + ": leaving go");
  }

  public void connect() {
    System.out.println(Thread.currentThread().getName() + ": entering
connect");
    try {
      if (jndiContext == null) {
        Hashtable env = new Hashtable();
 
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.swiftmq.jndi.InitialContextFact
oryImpl");
        env.put(Context.PROVIDER_URL,"smqp://localhost:4001/timeout=10000");
        System.out.println(Thread.currentThread().getName() + ": creating
Context");
        jndiContext = new InitialContext(env);
        System.out.println(Thread.currentThread().getName() + ": Context
created");
      }
      if (queueConnection == null) {
        if (queueConnectionFactory == null) {
          System.out.println(Thread.currentThread().getName() + ": creating
QueueConnectionFactory");
          queueConnectionFactory = (QueueConnectionFactory)
            jndiContext.lookup(QUEUECONFAC);
        }
        System.out.println(Thread.currentThread().getName() + ": creating
QueueConnection");
        queueConnection =
          queueConnectionFactory.createQueueConnection(username, password);
      }
      System.out.println(Thread.currentThread().getName() + ": creating
QueueSession");
      queueSession = queueConnection.createQueueSession(false,
        Session.AUTO_ACKNOWLEDGE);
      System.out.println(Thread.currentThread().getName() + ": creating
Queue");
      queue = (Queue) jndiContext.lookup(queueName);
      System.out.println(Thread.currentThread().getName() + ": starting
QueueConnection");
      queueConnection.start();
      if (jndiContext != null) {
        System.out.println(Thread.currentThread().getName() + ": closing
Context");
        jndiContext.close();
        jndiContext = null;
      }
    } catch (Exception e) {
      System.out.println(Thread.currentThread().getName() + e.toString());
    }
    System.out.println(Thread.currentThread().getName() + ": leaving
connect");
  }

  public void disconnect() {
    System.out.println(Thread.currentThread().getName() + ": entering
disconnect");
    try {
      if (queueSession != null) {
        System.out.println(Thread.currentThread().getName() + ": closing
QueueSession");
        queueSession.close();
      }
      if (queueConnection != null) {
        System.out.println(Thread.currentThread().getName() + ": closing
QueueConnection");
        queueConnection.close();
      }
      if (jndiContext != null) {
        System.out.println(Thread.currentThread().getName() + ": closing
Context");
        jndiContext.close();
      }
    } catch (Exception e) {
      System.out.println(Thread.currentThread().getName() + e.toString());
    } finally {
      queue = null;
      queueSession = null;
      queueConnection = null;
      queueConnectionFactory = null;
      jndiContext = null;
    }
    System.out.println(Thread.currentThread().getName() + ": leaving
disconnect");
  }
}
///////////////////////////////////////////////////////////

------------------------------------------------------
SwiftMQ developers mailing list * http://www.swiftmq.com
To unsubscribe from this list, send an eMail to 
[EMAIL PROTECTED] and write in the body of your message:
UNSUBSCRIBE developers <your-email-address>
Archive: http://www.mail-archive.com/developers@mail.iit.de/




Reply via email to