MangoAutomation / BACnet4J

BACnet/IP stack written in Java. Forked from http://sourceforge.net/projects/bacnet4j/
GNU General Public License v3.0
183 stars 110 forks source link

BACnet message is processing infinitely #66

Open lubomir-mitev opened 2 years ago

lubomir-mitev commented 2 years ago

BACnet version - 6.0.0.

We found that a message received from the bacnet4j leads to it's infinitely processing. This mean high CPU and no more communication with the devices. This is the log information: Received NPDU from [a,23,d4,e6,ba,c2]: NPDU [from=Address [networkNumber=0, macAddress=[a,23,d4,f,ba,c2]], linkService=null, queue=[10,4,9,7,1a,2,2,2e,0,0,0,5,0,0,0,20,1,b0,c8,6,0,0,0,2,0,3,a9,84,0,0,0,b,5e,d,9f,83,0,54,43,ae,0,0,0,7,f,ae,1,b0,38,3,10,0,0,0,40,45,ff,f0,0,f,b7,1,b0,50,2,10,0,0,0,20,0,0,0,1,f,fb,1,b0,50,3,10,0,0,0,40,42,87,0,0,f,fc,1,b0,50,4,10,0,0,0,20,0,0,0,3,f,fd,1,b0,50,5,10,0,0,0,40,42,c8,0,0,f,fe,1,b0,50,6,10,0,0,0,20,0,0,0,7,f,a0,1,b0,e8,d,10,0,0,0,20,0,0,0,3,2f]]

We created simple test - APDU with this queue. It's UnconfirmedRequest and when DefaultTransport invokes the method parseServiceData(), it never finish processing the data.

I don't know the BACnet device and also I don't know if the payload is correct or not. But the library must not process a message infinitely and must not stop the communications with the devices.

terrypacker commented 2 years ago

@lubomir-mitev can you provide your test code here? That will save time and I can review the problem and provide a fix.

Thanks for letting us know about this.

lubomir-mitev commented 2 years ago

InfinitelyTest.txt File is attached. Rename the file extension to java, because It's not possible to attach java file :( It's an unit test.