Possilble Deadlock situation!

Sir, i have tried to provide as much as material so that u also can reproduce the problem.
if i am doing any thing wrong, please let me know.

I have tried to simutate one deadlock situation .The files are…
Graph File:

<?xml version="1.0" encoding="UTF-8"?>

SPLIT COMPONENT’s Run Function:
This function tries to read from 0 port and Writes only on 0 number Port, Doesnt Write any thing on other OutPorts.
Logic:
public void run() {
boolean isDriverDifferent;

// get all ports involved
InputPort inPort = getInputPort(0);
DataRecord driverRecordread = new DataRecord(inPort.getMetadata());
driverRecordread.init();
// int numActive;// counter of still active ports - those without EOF status
int index=0;

//get array of all ports defined/connected - use collection Collection - getInPorts();
OutputPort outPorts;
outPorts = (OutputPort) getOutPorts().toArray(new OutputPort[0]);
//create array holding incoming records
outputRecords = new DataRecord[outPorts.length];

// initialize array of data records (for each input port one)
for (int i = 0; i < outPorts.length; i++) {
outputRecords[i] = new DataRecord(outPorts[i].getMetadata());
outputRecords[i].init();
}

//numActive=inPorts.length;
int cou = new int[5];

while (runIt) {
try {
driverRecordread = inPort.readRecord(driverRecordread);
if(driverRecordread != null){
//This Function Will always Return zero.
int result_t = 0;
outPorts[result_t].writeRecord(driverRecordread);

//System.out.println(“In Run: index” + result_t);
}else{
break;
}
} catch (IOException ex) {
resultMsg = ex.getMessage();
resultCode = Node.RESULT_ERROR;
closeAllOutputPorts();
return;
} catch (Exception ex) {
resultMsg = ex.getMessage();
resultCode = Node.RESULT_FATAL_ERROR;
return;
}
}
broadcastEOF();
if (runIt) {
resultMsg = “OK”;
} else {
resultMsg = “STOPPED”;
}
resultCode = Node.RESULT_OK;
}

Data File: Check.txt
1|two|three|four|
2|two|three|four|
3|two|three|four|


10000|two|three|four|

Hello !

This problem/issue is known - in situation like this, both edges - FINAL16,FINAL15 are bufferes so the SPLIT component can keep sending data to one or other and merge can
keep reading from both.

BUT ! the size of the buffer (which is internal) is limited and once filled, it causes the deadlock.

The solution:
a) increase the buffer size, so it can accomodate more records

b) put splitter and merger to two different phases - this ensures full buffering (on disk) so
you can first process all data in splitter and then merge them

c) don’t create transformation class/node with
two ports connected but the intention to send data only through one of them. If you want to crash the engine, you will definitely succeed :slight_smile: