Hello,
After compiling my 1.7.9 version C++ SDK using VS CODE, I running the example program "server_lesson01d" in the TERMINAL provided by VS CODE like:
"user@wpserver-Precision-5820-Tower:~/share/UA/sdk/build/examples/server_gettingstarted/lesson01$ ./server_lesson01d",
but the program crashed with message:
"server_lesson01d: /home/user/share/UA/sdk/src/uabase/uabasecpp/uaplatformlayer.cpp:372: static int UaPlatformLayer::init(): Assertion `(((uStatus) & 0xC0000000) == 0x00000000)' failed.Abandon (core dumped)".
and A dialog box pops up with message “Unable to open 'raise.c': Unable to read file '/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/raise.c' (Error: Unable to resolve non-existing file '/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/raise.c').”
However I running the example program in the Terminal provided by Ubuntu, it works well.
Then I debug the program using Debugger provided by VS CODE, the message above still appears, and the CALL STACK show like this:
libc.so.6!__GI_raise(int sig) (/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/raise.c:51)
libc.so.6!__GI_abort() (/build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:79)
libc.so.6!__assert_fail_base(const char * fmt, const char * assertion, const char * file, unsigned int line, const char * function) (/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:92)
libc.so.6!__GI___assert_fail(const char * assertion, const char * file, unsigned int line, const char * function) (/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:101)
UaPlatformLayer::init() (/home/user/share/UA/sdk/src/uabase/uabasecpp/uaplatformlayer.cpp:372)
OpcServerMain(const char * szAppPath) (/home/user/share/UA/sdk/examples/server_gettingstarted/lesson01/servermain.cpp:49)
main() (/home/user/share/UA/sdk/examples/server_gettingstarted/lesson01/servermain.cpp:141)
Do you know how to fix this?
Debug error using VS CODE
Moderator: uasdkcpp
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: Debug error using VS CODE
Hi,
the best way to analyze is:
> debug into the stack initialization and see what causes the assert (the assert is just there to inform you on potential configuration error).
The most educated guess we have is:
Your system (when using VS Code) allows file descriptors larger than FD_SETSIZE. This may lead to memory corruption in your application when exceeding the limit later during runtime (socket handle is file descriptor). For that reason it is important to think about correct FD_SETSIZE, depending on your target system and your use case, and to set your rlimit accordingly (ulimit -n).
the best way to analyze is:
> debug into the stack initialization and see what causes the assert (the assert is just there to inform you on potential configuration error).
The most educated guess we have is:
Your system (when using VS Code) allows file descriptors larger than FD_SETSIZE. This may lead to memory corruption in your application when exceeding the limit later during runtime (socket handle is file descriptor). For that reason it is important to think about correct FD_SETSIZE, depending on your target system and your use case, and to set your rlimit accordingly (ulimit -n).
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 2
- Joined: 24 May 2023, 02:21
Re: Debug error using VS CODE
Hello,
Yes,you are right.
I comment out the relevant lines in the CMakeLists.txt inside "sdk/src/uastack", around line 236 "add_definitions(-DUASTACK_FD_SETSIZE=65536)"
then the program run well.
Thank you very much.
Yes,you are right.
I comment out the relevant lines in the CMakeLists.txt inside "sdk/src/uastack", around line 236 "add_definitions(-DUASTACK_FD_SETSIZE=65536)"
then the program run well.
Thank you very much.