Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Dynamic type loader fails to deploy new FB Type(fail to deploy lua fb type in 4diac 2.0.1)
Dynamic type loader fails to deploy new FB Type [message #1849607] Wed, 26 January 2022 17:37 Go to next message
nan zhou is currently offline nan zhouFriend
Messages: 8
Registered: June 2018
Junior Member
Hello,

I'm updating my old version of 4diac to the latest 2.0.1, but I meet a problem when I'm using the Lua-based dynamic type loader. I choose the "DynamicTypeLoad" profile, and I compile forte source code by enabling the LuaJIT option. All necessary steps are done by following the document: https://www.eclipse.org/4diac/en_help.php?helppage=html/4diacIDE/dynamicTypeLoader.html

However, 4diac is stuck and pops up an error message:
index.php/fa/41586/0/

Everything is OK when I'm back to 4DIAC 1.13 and forte 1.13, with the same steps. My environment is Windows 11 x64, and the test 4diac project files are attached.

Last, I notice that each time a new FB type is created, a pointer to the instance of the CLuaBFBTypeEntry class will be created, but it seems that there is no call of its destructor function in forte, which leads to memory leaks when exiting forte. I've tested this problem in forte v1.13 using Visual Leak Detector on Windows.

index.php/fa/41588/0/
Re: Dynamic type loader fails to deploy new FB Type [message #1849644 is a reply to message #1849607] Thu, 27 January 2022 15:32 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Do you have any additional information like output of 4diac FORTE, or deployment console?
Re: Dynamic type loader fails to deploy new FB Type [message #1849646 is a reply to message #1849644] Thu, 27 January 2022 16:04 Go to previous messageGo to next message
nan zhou is currently offline nan zhouFriend
Messages: 8
Registered: June 2018
Junior Member
Thanks! Forte responds no error until deploying the FBType creation command. The output of forte and the deployment console during deployment is attached.

I also found that everything is normal when using 4diac 2.0.1 and forte 1.13. So, this may be a bug in the latest forte? I will have a try with other versions.
Re: Dynamic type loader fails to deploy new FB Type [message #1849684 is a reply to message #1849644] Sat, 29 January 2022 14:52 Go to previous messageGo to next message
nan zhou is currently offline nan zhouFriend
Messages: 8
Registered: June 2018
Junior Member
Hi Alois,

I think I've known where the problem is. After the 1.13 version, when enabling the "FORTE_DYNAMIC_TYPE_LOAD" option, the "FORTE_IPLayerRecvBufferSize" will not be changed from the default 1500 to a larger one (e.g., 20000). I think this may be a bug in the CMakeLists.txt.

So, when the IPcommlayer has no space for receiving bulk data of FB type definition, it will lead to an infinite loop inside the handledConnectedDataRecv() function of CIPComLayer. To solve this problem, I have to manually define the "FORTE_IPLayerRecvBufferSize" to a large value. Now, I can deploy dynamic FB type to the latest version of forte. But the memory leak problem still exists. I think I could create a patch for solving it.
Re: Dynamic type loader fails to deploy new FB Type [message #1849689 is a reply to message #1849684] Sat, 29 January 2022 19:33 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Hi Nan,

wow great that you found it. I was a bit lost after your second report. I feared we have some issues in our Lua code generator.

It would be great if you could provide a patch.

thx,
Alois
Re: Dynamic type loader fails to deploy new FB Type [message #1849703 is a reply to message #1849689] Sun, 30 January 2022 15:18 Go to previous messageGo to next message
nan zhou is currently offline nan zhouFriend
Messages: 8
Registered: June 2018
Junior Member
Hi Alois,

I found that the infinite loop inside the handledConnectedDataRecv() function of the CIPComLayer module is caused by the improper handling of the "mInterruptResp" variable.

When receiving a huge data stream of which the size is larger than "FORTE_IPLayerRecvBufferSize", the CFDSelectHandler will call the recvData() function of CIPCommlayer continuously and "mInterruptResp" will be set to "e_Nothing" during this procedure. Then, when the processInterrupt() of CIPCommlayer is called by another thread (event chain ), the last response code (such as "e_ProcessDataOk") now turns to a wrong value. Therefore, the received data will not be handled by the top layer any longer.

To solve this problem, I create a patch that introduces one more variable in CIPCommlayer named "mLastInterruptResp" to record the previous response code of the recvData() function. Now, we don't need to allocate a very large buffer size even when the "FORTE_DYNAMIC_TYPE_LOAD" option is enabled, since the fragmented TCP data can be properly handled.

I also upload the patches for solving the memory leaks problem when the "FORTE_DYNAMIC_TYPE_LOAD" option is enabled. I am sorry that I am not so familiar with creating patches, but I hope that these patches may be usable.
Re: Dynamic type loader fails to deploy new FB Type [message #1849709 is a reply to message #1849703] Sun, 30 January 2022 20:10 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Hi Nan,

thanks a lot for all the effort you spent. Unfortunately in this form we can not use the patches. We need to have them submitted following the Eclipse Foundations rules of contribution. This requires that you are signing a contributor agreement and that you submit the patches via GIT/Gerrit. I know this is for starting a bit complicated but rather important to keep the integrity of 4diac. Our committer Jose has written a very nice documentation of how the process works [1]. It would be great if you could try that.

Thanks again for your support,
Alois

[1] https://www.eclipse.org/4diac/en_help.php?helppage=html/development/contribute.html

Re: Dynamic type loader fails to deploy new FB Type [message #1849714 is a reply to message #1849709] Mon, 31 January 2022 03:56 Go to previous messageGo to next message
nan zhou is currently offline nan zhouFriend
Messages: 8
Registered: June 2018
Junior Member
Thanks, Alois, great documentation! I will take a try.
Re: Dynamic type loader fails to deploy new FB Type [message #1849716 is a reply to message #1849714] Mon, 31 January 2022 07:03 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Great! Thx.
Re: Dynamic type loader fails to deploy new FB Type [message #1849763 is a reply to message #1849716] Tue, 01 February 2022 15:43 Go to previous messageGo to next message
nan zhou is currently offline nan zhouFriend
Messages: 8
Registered: June 2018
Junior Member
Hi Alois,

I'm sorry that after I create a patch to Gerrit, the 4diac Bot reported a verification failure, and I have no idea of the reason. Can you please help me? Thanks!

The URL is: https://git.eclipse.org/r/c/4diac/org.eclipse.4diac.forte/+/190188
Re: Dynamic type loader fails to deploy new FB Type [message #1849767 is a reply to message #1849763] Tue, 01 February 2022 21:08 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Hi Nan,

it looks like our build server has some issues in getting all build requirements. Will look into it later this week. Keep you updated with comments in gerrit.

Alois
Previous Topic:Value Persistence across power cycle
Next Topic:4DIAC Debugging running application
Goto Forum:
  


Current Time: Fri Apr 26 11:06:03 GMT 2024

Powered by FUDForum. Page generated in 0.05807 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top