Coder Social home page Coder Social logo

carpc's Introduction

CARPC

carpc's People

Contributors

dterletskiy avatar dterletskiyluxoft avatar scorpion015 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

carpc's Issues

TAsyncTypeID simplification

TAsyncTypeID could be simplified using partial template specification for std::string and std::size_t instead of enable_if.

Example:

template< >
class TAsyncTypeID< std::string > : public TBaseAsyncTypeID< std::string >
{ ... };

template< >
class TAsyncTypeID< std::size_t > : public TBaseAsyncTypeID< std::size_t >
{ ... };

Crash during parsing configuration parameters

Application crash occurs during parsing configuration parameters in case of some configuration is missing.
terminate called after throwing an instance of 'std::bad_optional_access'

Service client does not receive notifications about attribute values change.

Describe the bug
Service client does not receive notifications about attribute values change.

To Reproduce
Steps to reproduce the behavior:

  1. Implement service client and server with attribute
  2. Subscribe on service attribute notification from client side
  3. Change attribute value on server side

Expected behavior
Client must receive notification

CARPC version
CARPC version or/and hash commit where issue is detected.

  • version: 3.8.15

Linix (please complete the following information):

  • Distribution: Any
  • Architecture: Any
  • Kernel Any

[CMake] Separate Compile definitions to a separate CMakeLists.txt

Is your feature request related to a problem? Please describe.

I'm trying to integrate carpc into my project, using the 'FetchContent' CMake feature. Currently, to make my project compile, I need to copy-paste the following options and the related code into my CMakeLists.txt:

option( SYS_TRACE                "Enable framework system tracing"                              ON )
option( MSG_TRACE                "Enable application tracing"                                   ON )
option( COLORED_TRACE            "Enable colored tracing for console"                           ON )
option( DLT_TRACE                "Enable dlt tracing"                                           ON )
option( MEMORY_HOOK              "Enable memory allocator hooks"                                OFF )
option( INSTRUMENTAL             "Enable instrumental functionality"                            OFF )
option( USE_DEBUG                "Enable debug information"                                     OFF )
option( USE_GPB                  "Enable goolgle protobuf"                                      ON )
option( USE_RTTI                 "Enable RTTI"                                                  ON )

###########################################################################################
#                                                                                         #
#                                   Compile definitions                                   #
#                                                                                         #
###########################################################################################
# https://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang
if( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
   message( NOTICE "compiler: Clang" )
   add_definitions( -Wall )
   add_definitions( -Wextra )
   add_definitions( -Wno-ignored-qualifiers )
   add_definitions( -Wno-unused-const-variable )
   add_definitions( -Wno-unused-variable )
   add_definitions( -Wno-unused-parameter )
   add_definitions( -Wno-unused-function )
   add_definitions( -Wno-unused-result )
   add_definitions( -Wno-unused-private-field )
   add_definitions( -Wno-overloaded-virtual )
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
   message( NOTICE "compiler: GCC" )
   add_definitions( -Wall )
   add_definitions( -Wextra )
   add_definitions( -Wno-ignored-qualifiers )
   add_definitions( -Wno-unused-but-set-variable )
   add_definitions( -Wno-unused-variable )
   add_definitions( -Wno-unused-parameter )
   add_definitions( -Wno-unused-function )
   add_definitions( -Wno-unused-result )
   add_definitions( -Wno-comment )
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
   msg_vrb( "compiler: Intel C++" )
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
   msg_vrb( "compiler: Visual Studio C++" )
endif( )

...

add_compile_definitions( OS_ANDROID=${OS_ANDROID} )
add_compile_definitions( OS_LINUX=${OS_LINUX} )
add_compile_definitions( OS_TARGET=${OS_TARGET} )
if( SYS_TRACE )
   add_compile_definitions( SYS_TRACE )
endif( )
if( MSG_TRACE )
   add_compile_definitions( MSG_TRACE )
endif( )
if( COLORED_TRACE )
   add_compile_definitions( COLORED_TRACE )
endif( )
if( DLT_TRACE )
   add_compile_definitions( USE_DLT )
endif( )
if( MEMORY_HOOK )
   add_compile_definitions( USE_MEMORY_HOOK )
endif( )
if( USE_GPB )
   find_package( Protobuf REQUIRED )
   add_compile_definitions( USE_GPB )
endif( )

I would like to avoid that copy-paste, as it will require continuous adaptations in case of the changes on the carpc side.

Describe the solution you'd like

I want to separate all CMake "compile definitions " related CMake options and directives into a separate 'CompileDefinitions.txt'. It will be included in the carpc's root CMakeLists.txt, and by the client's project once it is fetched from Github. That'll allow to eliminate the need to continuously adapt the CMake files.

Describe alternatives you've considered

The one and only alternative was to copy-paste the code. But that is too ugly to accept it.

Additional context

None

Obtaine application thread by name

Extend implementation by functionality to obtain application thread or its id by its name.
This is need for building context for sending async object. In this case there is no other information about context to send except of its thread name (process id is current or must be known).

[GENERAL] Crash during attempt to trace more than 4096 characters

It seems that the framework is causing a crash once the length of the trace string exceeds the limit.

Try out to use MSG_INF with a string of more than 4096 lengths.

Part of obtained call stack:

37198 2022/04/19 18:01:19.965921 115210.4142 177 ECU1 DLCF MAIN 887876 log info verbose 1 04-19 20:47:58.621 12153 12153 F DEBUG : #00 pc 0000000000002270 /vendor/lib64/tda.carpc.tracing.shared.so (carpc::trace::to_android(carpc::trace::eLogLevel const&)+0) (BuildId: 6faa9b69801d65b58d1c63e79b7b58fd)
37202 2022/04/19 18:01:19.965948 115210.4149 179 ECU1 DLCF MAIN 887876 log info verbose 1 04-19 20:47:58.621 12153 12153 F DEBUG : #1 pc 000000000002f11e /vendor/bin/epam/[email protected] (void carpc::trace::Logger::message<char const*, char const*, int, char const*, char const*>(carpc::trace::eLogLevel const&, char const*, char const*, char const*, int, char const*, char const*)+174) (BuildId: c6984a2f805895c54b16635dc5db3d4a)
37203 2022/04/19 18:01:19.965957 115210.4186 180 ECU1 DLCF MAIN 887876 log info verbose 1 04-19 20:47:58.621 12153 12153 F DEBUG : #2 pc 000000000002ebf4 /vendor/bin/epam/[email protected] (void carpc::trace::Logger::message_format<char const*, unsigned long>(carpc::trace::eLogLevel const&, char const*, char const*, int, char const*, char const*, unsigned long)+196) (BuildId: c6984a2f805895c54b16635dc5db3d4a)

[BUG] Memory corruption in IRunnable.cpp

The following line is causing a memory corruption:
https://github.com/dterletskiy/carpc/blob/main/runtime/imp/carpc/comm/async/runnable/IRunnable.cpp#L29

According to Address sanitizer:

09-15 17:42:19.242 12762 12769 I [email protected]: =================================================================
09-15 17:42:19.242 12762 12769 I [email protected]: ==12762==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7a12a42fafcc at pc 0x7a1545d5274c bp 0x7a1534efb530 sp 0x7a1534efb528
09-15 17:42:19.243 12762 12769 I [email protected]: WRITE of size 4 at 0x7a12a42fafcc thread T1
09-15 17:42:19.246 12762 12769 I [email protected]:     #0 0x7a1545d5274b  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0xdf74b)
09-15 17:42:19.247 12762 12769 I [email protected]:     #1 0x7a1545cf3152  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0x80152)
09-15 17:42:19.247 12762 12769 I [email protected]:     #2 0x7a1545cf1e54  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0x7ee54)
09-15 17:42:19.247 12762 12769 I [email protected]:     #3 0x7a1545d5aa95  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0xe7a95)
09-15 17:42:19.247 12762 12769 I [email protected]:     #4 0x7a153b7cd53a  (/apex/com.android.runtime/lib64/bionic/libc.so+0xc753a)
09-15 17:42:19.247 12762 12769 I [email protected]:     #5 0x7a153b765cc7  (/apex/com.android.runtime/lib64/bionic/libc.so+0x5fcc7)
09-15 17:42:19.247 12762 12769 I [email protected]:
09-15 17:42:19.247 12762 12769 I [email protected]: Address 0x7a12a42fafcc is located in stack of thread T6 (HwBinder:12762_)
09-15 17:42:19.247 12762 12769 I [email protected]:  at offset 236 in frame
09-15 17:42:19.247 12762 12769 I [email protected]:     #0 0x7a1545d1c0ff  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0xa90ff)
09-15 17:42:19.248 12762 12769 I [email protected]:
09-15 17:42:19.248 12762 12769 I [email protected]:   This frame has 9 object(s):
09-15 17:42:19.248 12762 12769 I [email protected]:     [32, 80) 'ref.tmp.i'
09-15 17:42:19.248 12762 12769 I [email protected]:     [112, 176) 'agg.tmp.i'
09-15 17:42:19.248 12762 12769 I [email protected]:     [208, 224) 'ref.tmp' (line 18)
09-15 17:42:19.248 12762 12769 I [email protected]:     [240, 241) 'ref.tmp5' (line 20) <== Memory access at offset 236 underflows this variable
09-15 17:42:19.248 12762 12769 I [email protected]:     [256, 280) 'ref.tmp6' (line 20)
09-15 17:42:19.248 12762 12769 I [email protected]:     [320, 344) 'ref.tmp8' (line 20)
09-15 17:42:19.254 12762 12769 I [email protected]:     [384, 400) 'ref.tmp9' (line 20)
09-15 17:42:19.254 12762 12769 I [email protected]:     [416, 544) 'cond_var' (line 29)
09-15 17:42:19.254 12762 12769 I [email protected]:     [576, 640) 'operation_wrapper' (line 32)
09-15 17:42:19.255 12762 12769 I [email protected]: HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
09-15 17:42:19.255 12762 12769 I [email protected]:       (longjmp and C++ exceptions *are* supported)
09-15 17:42:19.255 12762 12769 I [email protected]: Thread T6 (HwBinder:12762_) created by T1 here:
09-15 17:42:19.255 12762 12769 I [email protected]:     #0 0x7a1539912b1a  (/system/lib64/libclang_rt.asan-x86_64-android.so+0xa8b1a)
09-15 17:42:19.255 12762 12769 I [email protected]:     #1 0x7a15485db1ad  (/apex/com.android.vndk.v32/lib64/libutils.so+0x131ad)
09-15 17:42:19.256 12762 12769 I [email protected]:
09-15 17:42:19.256 12762 12769 I [email protected]: Thread T1 created by T0 here:
09-15 17:42:19.256 12762 12769 I [email protected]:     #0 0x7a1539912b1a  (/system/lib64/libclang_rt.asan-x86_64-android.so+0xa8b1a)
09-15 17:42:19.257 12762 12769 I [email protected]:     #1 0x7a1545d5aeeb  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0xe7eeb)
09-15 17:42:19.257 12762 12769 I [email protected]:     #2 0x7a1545cf43bb  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0x813bb)
09-15 17:42:19.257 12762 12769 I [email protected]:     #3 0x7a1545cccc05  (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0x59c05)
09-15 17:42:19.257 12762 12769 I [email protected]:     #4 0x5cccebbfb9db  (/vendor/bin/comp/[email protected]+0x5f9db)
09-15 17:42:19.258 12762 12769 I [email protected]:     #5 0x5cccebbfc7fc  (/vendor/bin/comp/[email protected]+0x607fc)
09-15 17:42:19.258 12762 12769 I [email protected]:     #6 0x7a153b755fb9  (/apex/com.android.runtime/lib64/bionic/libc.so+0x4ffb9)
09-15 17:42:19.258 12762 12769 I [email protected]:
09-15 17:42:19.259 12762 12769 I [email protected]: SUMMARY: AddressSanitizer: stack-buffer-overflow (/data/asan/vendor/lib64/tda.carpc.framework.shared.so+0xdf74b)
09-15 17:42:19.263 12762 12769 I [email protected]: Shadow bytes around the buggy address:
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d48575a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d48575b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d48575c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d48575d0: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d48575e0: f8 f8 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8 f8 f8 f8 f8
09-15 17:42:19.263 12762 12769 I [email protected]: =>0x0f42d48575f0: f8 f8 f2 f2 f2 f2 f8 f8 f2[f2]f8 f2 f8 f8 f8 f2
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d4857600: f2 f2 f2 f2 f8 f8 f8 f2 f2 f2 f2 f2 f8 f8 f2 f2
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d4857610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d4857620: f2 f2 f2 f2 00 00 00 00 00 00 00 00 f3 f3 f3 f3
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d4857630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
09-15 17:42:19.263 12762 12769 I [email protected]:   0x0f42d4857640: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
09-15 17:42:19.263 12762 12769 I [email protected]: Shadow byte legend (one shadow byte represents 8 application bytes):
09-15 17:42:19.263 12762 12769 I [email protected]:   Addressable:           00
09-15 17:42:19.263 12762 12769 I [email protected]:   Partially addressable: 01 02 03 04 05 06 07
09-15 17:42:19.263 12762 12769 I [email protected]:   Heap left redzone:       fa
09-15 17:42:19.263 12762 12769 I [email protected]:   Freed heap region:       fd
09-15 17:42:19.263 12762 12769 I [email protected]:   Stack left redzone:      f1
09-15 17:42:19.263 12762 12769 I [email protected]:   Stack mid redzone:       f2
09-15 17:42:19.263 12762 12769 I [email protected]:   Stack right redzone:     f3
09-15 17:42:19.263 12762 12769 I [email protected]:   Stack after return:      f5
09-15 17:42:19.263 12762 12769 I [email protected]:   Stack use after scope:   f8
09-15 17:42:19.263 12762 12769 I [email protected]:   Global redzone:          f9
09-15 17:42:19.263 12762 12769 I [email protected]:   Global init order:       f6
09-15 17:42:19.264 12762 12769 I [email protected]:   Poisoned by user:        f7
09-15 17:42:19.264 12762 12769 I [email protected]:   Container overflow:      fc
09-15 17:42:19.264 12762 12769 I [email protected]:   Array cookie:            ac
09-15 17:42:19.264 12762 12769 I [email protected]:   Intra object redzone:    bb
09-15 17:42:19.264 12762 12769 I [email protected]:   ASan internal:           fe
09-15 17:42:19.264 12762 12769 I [email protected]:   Left alloca redzone:     ca
09-15 17:42:19.264 12762 12769 I [email protected]:   Right alloca redzone:    cb
09-15 17:42:19.264 12762 12769 I [email protected]:   Shadow gap:              cc
09-15 17:42:19.264 12762 12769 I [email protected]: ==12762==ABORTING

The condition variable should stay alive until any of the threads are using it. But, currently, the following happens:

  1. Thread 1 is in "wait"
  2. Thread 2 calls "notify"
  3. Thread 1 awakes, goes out of "wait" and out of the outer function, and destroys the condition variable instance, which was created on the stack
  4. Thread 2 is still inside "notify" and is using the already destroyed instance of the condition variable

The fix is quite trivial - create the shared_ptr to ConditionVariable and capture it inside the operation_wrapper lambda, in order to prolong the life of the ConditionVariable until the required point of time.

Empty enumeration generated for non attribute

Describe the bug
In case of idl file does not contain any attribute generator produces enumeration macro with empty fields:
DEFINE_ENUMERATION( eID, std::uint8_t
);
This stuff can't be compiled.

Extend async::Runnable object for blocking execution

Extend async::Runnable object for blocking current (caller) thread until it was not executed in destination thread.
This functionality will be useful for synchronization application with android hidl/aidl oneway interfaces' methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.