You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file kinetic_logger.c defines a single static file handle to write log information into:
Line 34: static FILE* KineticLoggerHandle = NULL;
Through the config parameter for "KineticClient_Init()" (kinetic_client.c) it is suggested that each KineticClient can have its own log file. However, each call to KineticClient_Init() creates a new file and stores the reference in the global static KineticLoggerHandle. This leads to all KineticClients writing to the log file that was created with the last call to KineticClient_Init(). Also, if the last call to KineticClient_Init() configures no logging (KineticClientConfig.logFile = NULL), logging is disabled for all clients.
In summary, you can have multiple clients in parallel, but you cannot have multiple log files.
In very rare occasions, a segmentation fault can occur (in a multithreaded setup) at kinetic_logger.c, line 113: If threat A calls KineticClient_Init() with KineticClientConfig.logFile = NULL while thread B is descheduled at kinetic_logger.c line 110, the KineticLoggerHandle is set to NULL. Thread B will later execute kinetic_logger.c, line 113 causing fprintf to segfault.
Sugestions:
a) KineticLogger_Init() could check if KineticLoggerHandle is already set and print a notification.
b) Put the log file handle (KineticLoggerHandle) into struct _KineticSession or struct _KineticClient.
The text was updated successfully, but these errors were encountered:
rcrane
added a commit
to rcrane/kinetic-c
that referenced
this issue
Dec 1, 2016
The file kinetic_logger.c defines a single static file handle to write log information into:
Line 34: static FILE* KineticLoggerHandle = NULL;
Through the config parameter for "KineticClient_Init()" (kinetic_client.c) it is suggested that each KineticClient can have its own log file. However, each call to KineticClient_Init() creates a new file and stores the reference in the global static KineticLoggerHandle. This leads to all KineticClients writing to the log file that was created with the last call to KineticClient_Init(). Also, if the last call to KineticClient_Init() configures no logging (KineticClientConfig.logFile = NULL), logging is disabled for all clients.
In summary, you can have multiple clients in parallel, but you cannot have multiple log files.
In very rare occasions, a segmentation fault can occur (in a multithreaded setup) at kinetic_logger.c, line 113: If threat A calls KineticClient_Init() with KineticClientConfig.logFile = NULL while thread B is descheduled at kinetic_logger.c line 110, the KineticLoggerHandle is set to NULL. Thread B will later execute kinetic_logger.c, line 113 causing fprintf to segfault.
Sugestions:
a) KineticLogger_Init() could check if KineticLoggerHandle is already set and print a notification.
b) Put the log file handle (KineticLoggerHandle) into struct _KineticSession or struct _KineticClient.
The text was updated successfully, but these errors were encountered: