Refinitiv / Real-Time-SDK

Other
191 stars 128 forks source link

NullPointerException on closing OmmConsumer #15

Closed leichtundkross closed 8 years ago

leichtundkross commented 8 years ago

I have updated from SDK 1.0.5 to 1.0.7 and now I am facing some problems when I try to close the consumer.

I have written a small snippet that is pretty similar to the examples given in Dev Guide:

public class TrepClient {

    private static final OmmConsumerClient CONSUMER = new OmmConsumerClient() {

        @Override
        public void onUpdateMsg(UpdateMsg paramUpdateMsg, OmmConsumerEvent paramOmmConsumerEvent) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onStatusMsg(StatusMsg paramStatusMsg, OmmConsumerEvent paramOmmConsumerEvent) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onRefreshMsg(RefreshMsg paramRefreshMsg, OmmConsumerEvent paramOmmConsumerEvent) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onGenericMsg(GenericMsg paramGenericMsg, OmmConsumerEvent paramOmmConsumerEvent) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onAllMsg(Msg paramMsg, OmmConsumerEvent paramOmmConsumerEvent) {
            System.out.println(paramMsg);
        }

        @Override
        public void onAckMsg(AckMsg paramAckMsg, OmmConsumerEvent paramOmmConsumerEvent) {
            // TODO Auto-generated method stub
        }
    };

    public static void main(String[] args) throws InterruptedException {
        OmmConsumer consumer = null;

        try {
            OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig() //
                    .host("...") //
                    .applicationId("...") //
                    .username("...");

            consumer = EmaFactory.createOmmConsumer(config);

            ReqMsg reqMsg = EmaFactory.createReqMsg();
            reqMsg.serviceName("...") //
                    .name("...") //
                    .domainType(DomainTypes.MARKET_PRICE);
            consumer.registerClient(reqMsg, CONSUMER);

            Thread.sleep(1000);
        } finally {
            if (consumer != null) {
                consumer.uninitialize();
            }
        }
    }
}

And this is the output:

Okt 18, 2016 2:51:38 PM com.thomsonreuters.ema.access.ConfigErrorTracker log
INFORMATION: loggerMsg
    ClientName: EmaConfig
    Severity: Info
    Text:    reading configuration file [EmaConfig.xml] from [...]
loggerMsgEnd

Okt 18, 2016 2:51:38 PM com.thomsonreuters.ema.access.ConfigErrorTracker log
SCHWERWIEGEND: loggerMsg
    ClientName: EmaConfig
    Severity: Error
    Text:    Cannot locate configuration source EmaConfig.xml
loggerMsgEnd

Okt 18, 2016 2:51:38 PM com.thomsonreuters.ema.access.ChannelCallbackClient reactorChannelEventCallback
INFORMATION: loggerMsg
    ClientName: ChannelCallbackClient
    Severity: Info
    Text:    Received ChannelUp event on channel Channel
    Instance Name EmaConsumer_1
    Component Version ads2.6.10.L1.linux.tis.rrg 64-bit
loggerMsgEnd

RefreshMsg
    streamId="5"
    domain="MarketPrice Domain"
    solicited
    RefreshComplete
    state="Open / Ok / None / '*None'"
    itemGroup="00 03"
    name="..."
    nameType="1"
    serviceId="..."
    serviceName="..."
    Payload dataType="FieldList"
        FieldList FieldListNum="0" DictionaryId="1"
            FieldEntry fid="2" name="RDNDISPLAY" dataType="UInt" value="(blank data)"
        FieldListEnd
    PayloadEnd
RefreshMsgEnd

Okt 18, 2016 2:51:39 PM com.thomsonreuters.ema.access.ChannelDictionary processCallback
WARNUNG: loggerMsg
    ClientName: ChannelDictionary
    Severity: Warning
    Text:    RDMDictionary stream was closed with status message
    streamId 3
    Reason State: Closed/Suspect/None - text: "channel down."
loggerMsgEnd

StatusMsg
    streamId="5"
    domain="MarketPrice Domain"
    state="Closed / Suspect / None / 'channel down.'"
    name="..."
    serviceId="..."
    serviceName="..."
StatusMsgEnd

Okt 18, 2016 2:51:39 PM com.thomsonreuters.ema.access.ChannelDictionary processCallback
WARNUNG: loggerMsg
    ClientName: ChannelDictionary
    Severity: Warning
    Text:    RDMDictionary stream was closed with status message
    streamId 4
    Reason State: Closed/Suspect/None - text: "channel down."
loggerMsgEnd

Exception in thread "pool-2-thread-1" java.lang.NullPointerException
    at com.thomsonreuters.upa.valueadd.reactor.Reactor.sendChannelEventCallback(Unknown Source)
    at com.thomsonreuters.upa.valueadd.reactor.Reactor.sendAndHandleChannelEventCallback(Unknown Source)
    at com.thomsonreuters.upa.valueadd.reactor.Reactor.dispatchChannel(Unknown Source)
    at com.thomsonreuters.upa.valueadd.reactor.ReactorChannel.dispatch(Unknown Source)
    at com.thomsonreuters.ema.access.OmmBaseImpl.rsslReactorDispatchLoop(Unknown Source)
    at com.thomsonreuters.ema.access.OmmBaseImpl.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

By the way, sometimes the application exits with another stacktrace:

Exception in thread "pool-2-thread-1" java.nio.channels.ClosedSelectorException
    at sun.nio.ch.SelectorImpl.selectedKeys(Unknown Source)
    at com.thomsonreuters.ema.access.OmmBaseImpl.rsslReactorDispatchLoop(Unknown Source)
    at com.thomsonreuters.ema.access.OmmBaseImpl.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
maydu commented 8 years ago

We has identified these two issues, they will be fixed in next patch or release. Thank you very much for reporting the issues.

GregLee-TR commented 8 years ago

The issues have been captured in EMA-790 and EMA-791. We will address these in a future update.