Error Handler



Runtime errors in the RXF or RTOS extentions are handled by the error handler RiCErrorHandler_error(), which is implemented as an endles loop. The C code is available in the source file RiCErrorHandler.c in the directory <your RXF installation path on Linux>/<your product>/Source. You may change it according your needs.

The function RiCErrorHandler_error() uses enumerated constants, defined in RiCErrorHandler.h which are described below. When debugging, tracing the call stack will help you understand what went wrong:


OXF_INFINITE_NULL_TRANS The function RiCReactive_consumeEvent() has detected an infinit loop when executing your UML model.
Please read the section on "Null Transitions" in the Rhapsody in C User Guide by IBM Rational.
The constant OMDEFAULT_MAX_NULL_STEPS which defines the maximum, is set in RiCReactive.c, its default value is 100.
OXF_TASK_CREATE_FAILED There are several possible causes for this:
  • the RTOS Bridge WSTRTOS_Init() failed to create a thread for the main task: pthread_create() returned an error.
    The variable errno will be set and will indicate the reason.
  • the function RiCOSTimer_init() failed to create a thread for the bridge task: pthread_create() returned an error.
    The variable errno will be set and will indicate the reason.
  • the function RiCOSTask_create() failed due to not having enough dynamic memory. The RiCOSTask structure and the task stack needed  are allocated dynamically.
  • The function RiCOSTask_create() is passed a NULL pointer, which is considered an internal RXF error.
  • the Framework is not capable of creating a new task, caused by Linux not having enough resources.
OXF_TASK_INIT_FAILED Reserved for future use.
OXF_TASK_WAIT_FAILED Reserved for future use.
OXF_TASK_START_FAILED Reserved for future use.
OXF_TASK_WAKE_FAILED The function RiCOSTask_resume() fails to lock or unlock a mutex used to prevent a race conditioning in waking up the specified task.
OXF_TASK_NAME_FAILED Reserved for future use.
OXF_TASK_PRIORITY_FAILED There are several possible causes for this:
  • the executable you created like in the GettingStarted example, does not have the priviledges to change the priority of a task in Linux. The system call pthread_setschedparam() needs the calling process to have have superuser permissions:
    • run it as superuser or
    • set the SUID bit on the executable you created to run it as superuser.
  • the priority used in RiCOSTask_start() and specified in the system call pthread_setschedparam() does not match the range PRIORITY_MIN to PRIORITY_MAX on your system.
    This is either the default priority RTOS_PRIORITY_NORMAL specified in WSTRTOS.h or the priority specified in Rhapsody for an active object. 
  • the priority argument passed on behalf of RiCTask_setPriority() to the system call pthread_setschedparam() does not match the range PRIORITY_MIN to PRIORITY_MAX on your system. Please inspect errno for the cause.
  • the priority used for the bridge task in RiCOSTimer_init() and specified in the system call pthread_setschedparam() does not match the range PRIORITY_MIN to PRIORITY_MAX on your system.
    This is either the priority RTOS_PRIORITY_HIGH or RTOS_PRIORITY_LOW specified in WSTRTOS.h
  • the priority RTOS_PRIORITY_NORMAL specified in WSTRTOS.h used for the main task in rhpMainTask() and specified in the system call pthread_setschedparam() does not match the range PRIORITY_MIN to PRIORITY_MAX on your system.
  • the function RiCOSTask_setPriority() or rhpMainTask() fails to query the existing priority for the specified task using pthread_getschedparam().
OXF_TASK_DELETE_FAILED There are several possible causes for this:
  • the function RiCOSTask_endMyTask() failed to kill a thread for the current task: pthread_kill() returned an error.
  • the function RiCOSTask_endOtherTask() failed to kill a thread for the specified task: pthread_kill() returned an error.
  • the function RiCOSTask_endMyTask() is passed a NULL pointer, which is considered an internal RXF error.
  • the function RiCOSTask_endOtherTask() is passed a NULL pointer, which is considered an internal RXF error.
OXF_TASK_CLEANUP_FAILED The function RiCOSTask_cleanup() is passed a NULL pointer
OXF_TASK_SETSTACK_FAILED There are two possible locations, and errno will indicate the reason:
  • the function RiCOSTimer_init() fails to set the priority of the Bridge task.
  • the function WSTRTOS_Init() fails to set the priority of the Main task.
OXF_TIMER_CREATE_FAILED The Framework is not capable of creating a new timer, caused by Linux not having enough resources to allocate a RiCOSTimer structure.
OXF_TIMER_START_FAILED Reserved for future use.
OXF_TIMER_DELETE_FAILED Reserved for future use.
OXF_TIMER_DESTROY_FAILED Reserved for future use.
OXF_MBOX_FAILED Reserved for future use.
OXF_MBOX_SEND_FAILED Reserved for future use.
OXF_MBOX_WAIT_FAILED Reserved for future use.
OXF_MBOX_PEND_FAILED Reserved for future use.
OXF_EVENT_FAILED Reserved for future use.
OXF_SOCKET_FAILED Reserved for future use.
OXF_INTR_INIT_FAILED Reserved for future use.
OXF_RTOS_ERROR There are several possible causes for this:
  • the function WSTRTOS_Init() fails to prepare the main task properly to run.
  • the bridge task wokeup from clock_nanosleep() which returned an error, but not because the task was interrupted (errno set to EINTR). The variable errno will be set and will indicate the reason.
  • the function RiCOSEndApplication() is called and it passes the error code to RiCErrorHandler()
  • the RTOS Bridge WSTRTOS_Init() returned and did not start the main task.
OXF_BRIDGE_TIMER_FAILED Reserved for future use.
OXF_BRIDGE_CREATE_FAILED Reserved for future use.
OXF_BRIDGE_START_FAILED Reserved for future use.
OXF_SEMA_CREATE_FAILED The Framework is not capable of creating a new semaphore, caused by Linux not having enough resources to allocate a RiCOSSemaphore structure.
OXF_SEMA_INIT_FAILED There are several possible causes for this:
  • the Framework is not capable of initializing a semaphore, because its initial count exceeds INT_MAX as specified via <limits.h> of your toolchain.
  • the function RiCOSSemaphore_init() failed to initialize a semaphore: sem_init() returned an error. The variable errno will be set and will indicate the reason.
OXF_SEMA_DESTROY_FAILED Reserved for future use.
OXF_SEMA_CLEANUP_FAILED The function RiCOSSemaphore_cleanup() failed to destroy a semaphore: sem_destroy() returned an error. The variable errno will be set and will indicate the reason.
OXF_SEMA_SIGNAL_FAILED The function RiCOSSemaphore_signal() failed to post to a semaphore: sem_post() returned an error. The variable errno will be set and will indicate the reason.
OXF_SEMA_WAIT_FAILED The function RiCOSSemaphore_wait() failed to wait for a semaphore: sem_timedwait() returned an error. The variable errno will be set and will indicate the reason.
OXF_MUTEX_CREATE_FAILED The Framework is not capable of creating a new mutex, caused by Linux not having enough resources to allocate a RiCOSMutex structure.
OXF_MUTEX_INIT_FAILED The function RiCOSMutex_init() failed to initialize a mutex: pthread_mutex_init() returned an error. The variable errno will be set and will indicate the reason.
OXF_MUTEX_DESTROY_FAILED Reserved for future use.
OXF_MUTEX_LOCK_FAILED There are several possible causes for this:
OXF_MUTEX_CLEANUP_FAILED The  function RiCOSMutex_cleanup() failed to destroy a mutex: pthread_mutex_destroy() returned an error. The variable errno will be set and will indicate the reason.
OXF_MUTEX_FREE_FAILED There are several possible causes for this:
OXF_INVALID_MUTEX_ID Reserved for future use.
OXF_EVFLAG_CREATE_FAILED The Framework is not capable of creating a new event flag, caused by Linux not having enough resources to allocate a RiCOSEventFlag structure.
OXF_EVFLAG_INIT_FAILED Reserved for future use.
OXF_EVFLAG_DESTROY_FAILED Reserved for future use.
OXF_EVFLAG_CLEANUP_FAILED Reserved for future use.
OXF_EVFLAG_RESET_FAILED Reserved for future use.
OXF_EVFLAG_WAIT_FAILED Reserved for future use.
OXF_EVFLAG_SIGNAL_FAILED Reserved for future use.
OXF_MSGQ_CREATE_FAILED The Framework is not capable of creating a new message queue, caused by Linux not having enough resources to allocate a RiCOSMessageQueue structure.
OXF_MSGQ_DESTROY_FAILED Reserved for future use.
OXF_MSGQ_INIT_FAILED There are two possible causes for this:
  • the function RiCOSMessageQueue_init() failed to create a message queue: mq_open() returned an error. The variable errno will be set and will indicate the reason.
  • the Framework is not capable of initializing a RiCOSMessageQueue structure, caused by Linux not having enough resources to allocate a RiCOSMessageQueue structure.
OXF_MSGQ_GET_FAILED There are two possible causes for this:
  • the function RiCOSMessageQueue_get() failed to receive bytes from a message queue: mq_receive() returned an error. The variable errno will be set and will indicate the reason.
  • the function RiCOSMessageQueue_get() failed to get the attributes of a message queue: mq_getattr() returned an error. The variable errno will be set and will indicate the reason.
OXF_MSGQ_PUT_FAILED There are several possible causes for this:
  • the function RiCOSMessageQueue_put() failed because the maximum number of messages queued is reached. This number is set via the constant RTOS_MQ_DEFAULT_SIZE in WSTRTOS.h which may not exceed the constant MSGMNB in Linux.
  • the function RiCOSMessageQueue_put() failed to send bytes into a message queue: mq_send() returned an error. The variable errno will be set and will indicate the reason.
  • the function RiCOSMessageQueue_put() failed to get the attributes of a message queue: mq_getattr() returned an error. The variable errno will be set and will indicate the reason.
OXF_MSGQ_FULL_FAILED Reserved for future use.
OXF_MSGQ_PEND_FAILED The function RiCOSMessageQueue_pend() failed to get the attributes of a message queue: mq_getattr() returned an error. The variable errno will be set and will indicate the reason.
OXF_MSGQ_EMPTY_FAILED Reserved for future use.
OXF_MSGQ_LIST_FAILED Reserved for future use.
OXF_MSGQ_CLEANUP_FAILED The function RiCOSMessageQueue_cleanup() failed to close the message queue: mq_close() returned an error. The variable errno will be set and will indicate the reason.
OXF_EMPTY_ME_PTR The me pointer passed in a function of the RTOS Adapter  is NULL.
OXF_ALLOC_FAILED The function RiCMemoryAllocator_getMemory() or RiCOSMemoryAllocation_malloc() or RiCOSMemoryAllocation_realloc()  fails to allocate memory.
Please also look at the constant NO_MALLOC.
OXF_NOT_IMPLEMENTED A function calloc() which is protected against task switches, see RiCOSMemoryAllocation_calloc() in RiCOSDimMemoryAllocation.c is not implemented.
OXF_VERSION_ERROR Reserved for future use. We are working on a runtime check on different options set for library and the rest 





Copyright (c) Willert Software Tools GmbH. All rights reserved.