Jump to content

[SOLVED] VR-Forces DIS woes (crash of DISConnector?)


photo

Recommended Posts

Hello,

We have to use VR-Forces (and a specific version of it), which seems to send malformed or strange packets, causing troubles to DISConnector.

Most of the times, the app shows a error in the console, and DIS entities are not visible (not loaded at all, as the callback onReceivePacketCallback is not called).

Apparently, we have to "plugin_reload DISConnector" so the entities are visible. Here is attached a pcap of the DIS as received by the IG. The plugin loaded are (SDK2.16) IG,Syncker,CIGIConnector,DISConnector.

Here is the relevant parts of the log:

---- DISConnector ----
Version: revision: 'ver-2.16.1.0-6698bfb' datetime: Dec 15 2022 14:02:13 
(...)
DIS reporting to 127.0.0.1:0

---- DIS info ----
Send address: 127.0.0.1
Port: 3000
Connection type: Broadcast
Site: 1
Exercise: 1
App: 666
(...)
DISThread::process:: GetNexPDU has thrown an exception: "KDIS::PDU::Header7::Decode: Buffer Does Not Contain Enough Information To Decode. " (this Exception will be ignored further)
Unigine~# plugin_reload DISConnector
Loading "DISConnector_double_x64d.dll"...


---- DISConnector ----
Version: revision: 'ver-2.16.1.0-6698bfb' datetime: Dec 15 2022 14:02:13


---- DIS info ----
Send address: 10.18.135.127
Port: 3000
Connection type: Broadcast
Site: 1
Exercise: 1
App: 666

DISThread::process:: GetNexPDU has thrown an exception: "KDIS::PDU::Header7::Decode: Buffer Does Not Contain Enough Information To Decode. " (this Exception will be ignored further)
DISThread::process:: GetNexPDU has thrown an exception: "KDIS::DATA_TYPE::EnvironmentRecord::FactoryDecodeEnvironmentRecord: Unsupported Data Type, Can Not Decode. 4360" (this Exception will be ignored further)

The debugger shows a lot of exception 

Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
DISThread::process:: GetNexPDU has thrown an exception: "KDIS::PDU::Header7::Decode: Buffer Does Not Contain Enough Information To Decode. " (this Exception will be ignored further)
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDAA0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDAA0.
DISThread::process:: GetNexPDU has thrown an exception: "KDIS::DATA_TYPE::EnvironmentRecord::FactoryDecodeEnvironmentRecord: Unsupported Data Type, Can Not Decode. 4360" (this Exception will be ignored further)
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : [rethrow] à l'emplacement de mémoire 0x0000000000000000.
Exception levée à 0x00007FFF396ECF19 dans EVA_x64d.exe : exception Microsoft C++ : KDIS::KException à l'emplacement de mémoire 0x000000039F1FDBF0.

I tried to forcefully ignore all packets except the one we care for, but this doesn't change: we still have to hot reload the plugin

	// ignore all PDU by default
	for (int i = 0; i <= 255; ++i)
		dis->setProcessPacket(i, false);
	// Support this PDU
	dis->setProcessPacket(KDIS::DATA_TYPE::ENUMS::PDUType::Entity_State_PDU_Type, true);

 

Is there any thing we can do?

Bonus question: is it possible to detect that DISConnector crashed and needs to be reloaded?

Is there a callback when a plugin has been reloaded?

Thanks!

dis_tiger.pcap

Link to comment

Hello!

We use the KDIS library for establishing connections and parsing DIS packets. These exceptions were caused by errors within the KDIS library.

Specifically, this issue:
DISThread::process:: GetNexPDU has thrown an exception: "KDIS::PDU::Header7::Decode: Buffer Does Not Contain Enough Information To Decode. "

On our side, we are simply calling GetNextPDU without interfering with the library's logic.

Unigine::DISThread.cpp

try
{
    pdu = connection->GetNextPDU();
} catch (KDIS::KException & except) 
{
    if (!known_errors_get_pdu[except.m_ui16ErrorCode])
        Unigine::Log::error("%s:: GetNexPDU has thrown an exception: \"%s\" (this Exception will be ignored further)\n", __UNIGINE_FUNC__, except.what());
    known_errors_get_pdu[except.m_ui16ErrorCode] = true;
}


This exception, "Buffer Does Not Contain Enough Information To Decode," is triggered by KDIS when the header size is smaller than expected.

KDIS/PDU/Header7.cpp:

void Header7::Decode( KDataStream & stream, bool ignoreHeader /*= false*/ ) throw( KException )
{
    if( !ignoreHeader )
    {
        if( stream.GetBufferSize() < HEADER6_PDU_SIZE )throw KException( __FUNCTION__, NOT_ENOUGH_DATA_IN_BUFFER );

      //.....

the same for "KDIS::DATA_TYPE::EnvironmentRecord::FactoryDecodeEnvironmentRecord: Unsupported Data Type, Can Not Decode. 4360"

KDIS/DataTypes/EnvironmentRecord.cpp:

EnvironmentRecordPtr EnvironmentRecord::FactoryDecodeEnvironmentRecord( KDataStream & stream ) throw( KException )
{
//....

    switch( ui32RecType )
    {
		//...
		case COMBICStateType: return new COMBICState( stream );
		case FlareStateType:  return new FlareState( stream );
		default:              throw KException( __FUNCTION__, UNSUPPORTED_DATATYPE, ui32RecType ); // We don't know how to decode this type.
    }    
}

It is possible that the errors are related to KDIS failing to parse a certain packet, causing everything to go off track afterwards.

The setProcessPacket method only disables packet processing on the Unigine side but not inside KDIS library.

It might be resolved by setting up your own PDUFactory to handle custom packets (by obtaining a Connection through setConnectionThreadCallbacks or initializing DISConnector with your own Connection).

However, there are several options available to assist you with the issue. To provide you with potential solutions, we kindly ask that you utilize our internal support system, accessible via the following link: https://developer.unigine.com/en/personal/create-support-ticket

Link to comment
  • bmyagkov changed the title to [SOLVED] VR-Forces DIS woes (crash of DISConnector?)

This issue will be addressed in the upcoming SDK 2.19 release by upgrading the 3rd party KDIS library to version 2.10.

Thanks!

Link to comment
×
×
  • Create New...