Hi,
There is some bug while the components cleaning up (nrModbus, component slave mode over TCP)
Reproduction:
Start the application, open it in slave mode. Connect to it from a MODBUS master and query one Register or Coil. Then close the app while the nrModbus component is active.
On the FormCloseQuery after isClosing:= true;
I insert nrModbus1.active := false;
but this is not helping and the app is crashing while cleaning up.
When I click the open chekcbox while it is active, to deactivate the nrModbus then it is crashing too.
I quote here the eurekalog crash report with call stack.
QuoteEurekaLog 7.7.8.10 Beta 10 957785AB85E16142AFFD94BD5B4752AE 7E306ECC26DBC0479FD66BD83A2450BF DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 344F708385631B49BD8AE7D046D6F15E
Application:
------------------------------------------------------
1.1 Start Date : Sun, 3 Feb 2019 11:11:53 +0100
1.2 Name/Description: ModbusDemo.exe - (ModbusDemo)
1.3 Version Number : 1.0.0.0
1.4 Parameters :
1.5 Compilation Date: Sun, 3 Feb 2019 11:11:38 +0100
1.6 Up Time : 14 second(s)
Exception:
---------------------------------------------------------------------------------------------------------------
2.1 Date : Sun, 3 Feb 2019 11:12:08 +0100
2.2 Address : 007B3289
2.3 Module Name : ModbusDemo.exe - (ModbusDemo)
2.4 Module Version: 1.0.0.0
2.5 Type : EExternalException
2.6 Message : Access violation at address 007B3289 in module 'ModbusDemo.exe'. Read of address 00000001
.
Module:_ModbusDemo.exe
Code:_C0000005 (EXCEPTION_ACCESS_VIOLATION)
Address:_007B3289 (003B3289).
2.7 ID : 0129DCC7
2.8 Count : 1
2.11 Sent : 0
User:
---------------------------------------
3.2 Name : Dobi Sandor
3.3 Email: dobi.sandor@codewizards.hu
Steps to reproduce:
------------
8.1 Text:
Start the application, open it in slave mode. Connect to it from a MODBUS master and query one Register or Coil. Then close the app while the nrModbus component is active.
On the FormCloseQuery after isClosing:= true;
I insert nrModbus1.active := false;
but this is not helping and the app is crashing while cleaning up.
Call Stack Information:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|Methods |Details|Stack |Address |Module |Offset |Source |Unit |Class |Procedure/Method |Line |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|*Exception Thread: ID=5136; Parent=0; Priority=0 |
|Class=; Name=MAIN |
|DeadLock=0; Wait Chain= |
|Comment= |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|7FFFFFFE|04 |00000000|007B3289|ModbusDemo.exe|003B3289|nrclasses.pas |nrclasses |TnrNotifyList |Get |539[1] |
|00000060|04 |0019FD44|007B32F7|ModbusDemo.exe|003B32F7|nrclasses.pas |nrclasses |TnrNotifyList |IndexOf |657[3] |
|00000020|04 |0019FD54|0051F7F1|ModbusDemo.exe|0011F7F1|System.Classes.pas |System.Classes |TComponent |RemoveNotification |16333[13] |
|00000060|04 |0019FD68|007B3FE9|ModbusDemo.exe|003B3FE9|nrclasses.pas |nrclasses |TnrBaseIO |NotifyDelete |1017[1] |
|00000020|04 |0019FD74|0051F813|ModbusDemo.exe|0011F813|System.Classes.pas |System.Classes |TComponent |RemoveFreeNotification |16340[2] |
|00000060|04 |0019FD80|007B3914|ModbusDemo.exe|003B3914|nrclasses.pas |nrclasses |TnrCustomDataProcessor|SetDevice |825[2] |
|00000060|04 |0019FD98|007B385A|ModbusDemo.exe|003B385A|nrclasses.pas |nrclasses |TnrCustomDataProcessor|Notification |801[4] |
|00000060|04 |0019FDAC|0051F361|ModbusDemo.exe|0011F361|System.Classes.pas |System.Classes |TComponent |RemoveFreeNotifications |16162[4] |
|00000020|04 |0019FDC4|0051F188|ModbusDemo.exe|0011F188|System.Classes.pas |System.Classes |TComponent |Destroy |16090[2] |
|00000020|04 |0019FDD0|007B3F88|ModbusDemo.exe|003B3F88|nrclasses.pas |nrclasses |TnrBaseIO |Destroy |1005[14] |
|00000060|04 |0019FDE0|007C67E6|ModbusDemo.exe|003C67E6|nrsocket.pas |nrsocket |TnrSocket |Destroy |177[22] |
|00000060|04 |0019FDF0|00408AD8|ModbusDemo.exe|00008AD8|System.pas |System |TObject |Free |17465[0] |
|00000060|04 |0019FE00|007C7023|ModbusDemo.exe|003C7023|nrsocket.pas |nrsocket |TnrSocket |RequestDeviceHandleClose|308[7] |
|00000060|04 |0019FE1C|007B42D5|ModbusDemo.exe|003B42D5|nrclasses.pas |nrclasses |TnrBaseIO |Close |1116[4] |
|00000060|04 |0019FE38|007C6F92|ModbusDemo.exe|003C6F92|nrsocket.pas |nrsocket |TnrSocket |Close |296[1] |
|00000060|04 |0019FE44|007C677E|ModbusDemo.exe|003C677E|nrsocket.pas |nrsocket |TnrSocket |Destroy |167[12] |
|00000060|04 |0019FE54|00408AD8|ModbusDemo.exe|00008AD8|System.pas |System |TObject |Free |17465[0] |
|00000020|04 |0019FE64|0051F6F6|ModbusDemo.exe|0011F6F6|System.Classes.pas |System.Classes |TComponent |DestroyComponents |16294[10] |
|00000020|04 |0019FE80|0051F18F|ModbusDemo.exe|0011F18F|System.Classes.pas |System.Classes |TComponent |Destroy |16091[3] |
|00000020|04 |0019FE8C|006A2171|ModbusDemo.exe|002A2171|Vcl.Controls.pas |Vcl.Controls |TControl |Destroy |5471[24] |
|00000020|04 |0019FEA4|0050B06F|ModbusDemo.exe|0010B06F|System.Classes.pas |System.Classes |TPersistent |Destroy |5602[3] |
|00000020|04 |0019FEB0|00408AD8|ModbusDemo.exe|00008AD8|System.pas |System |TObject |Free |17465[0] |
|00000020|04 |0019FEC0|006A6C49|ModbusDemo.exe|002A6C49|Vcl.Controls.pas |Vcl.Controls |TWinControl |Destroy |8587[45] |
|00000020|04 |0019FEE0|0075E1C3|ModbusDemo.exe|0035E1C3|Vcl.Forms.pas |Vcl.Forms |TScrollingWinControl |Destroy |3122[3] |
|00000020|04 |0019FEF4|0075F068|ModbusDemo.exe|0035F068|Vcl.Forms.pas |Vcl.Forms |TCustomForm |Destroy |3808[32] |
|00000020|04 |0019FF24|00408AD8|ModbusDemo.exe|00008AD8|System.pas |System |TObject |Free |17465[0] |
|00000020|04 |0019FF34|0051F6F6|ModbusDemo.exe|0011F6F6|System.Classes.pas |System.Classes |TComponent |DestroyComponents |16294[10] |
|00000020|04 |0019FF50|0075CF7D|ModbusDemo.exe|0035CF7D|Vcl.Forms.pas |Vcl.Forms | |DoneApplication |2220[9] |
|00000020|04 |0019FF54|0047975D|ModbusDemo.exe|0007975D|System.SysUtils.pas|System.SysUtils| |DoExitProc |5918[6] |
|00000020|04 |0019FF5C|0040A7D6|ModbusDemo.exe|0000A7D6|System.pas |System | |_Halt0 |24661[55] |
|00004020|04 |0019FF6C|007D937A|ModbusDemo.exe|003D937A|ModbusDemo.dpr |ModbusDemo | |Initialization |27[5] |
|00004020|03 |0019FF84|76D58482|kernel32.dll |00018482|KERNEL32.DLL |KERNEL32 | |BaseThreadInitThunk | |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thank you for information.
It seems like we reproduced exception on closing app in slave mode and fixed problem.
We are going to release a new version of nrComm Lib in next two days.
You can check the new compiled Modbus demo here:
http://updates.nrcommlib.com/ModbusDemo_32bit.zip
Roman Novgorodov
DeepSoftware llc