Closed Ptlia closed 6 months ago
lineBuffer is declare as static, and cannot parse a model in multhreading-multiserver environnment when them parse in same time.
Juste declare with GLOBAL_ALLOC in beginning of funciton and free at the end
// Begin uint8_t lineBuffer = (uint8_t) GLOBAL_MALLOC(READ_BUFFER_MAX_SIZE * sizeof(uint8_t)); if (lineBuffer == NULL) goto exit_error;
// End
GLOBAL_FREEMEM(lineBuffer); return model;
exit_error: if (DEBUG_IED_SERVER) printf("IED_SERVER: error parsing line %i (indentation level = %i)\n", currentLine, indendation);
GLOBAL_FREEMEM(lineBuffer); if (model != NULL) IedModel_destroy(model); return NULL;
Thanks for the hint. I updated the code to use dynamic memory instead the global static variable.
lineBuffer is declare as static, and cannot parse a model in multhreading-multiserver environnment when them parse in same time.
Juste declare with GLOBAL_ALLOC in beginning of funciton and free at the end
// Begin uint8_t lineBuffer = (uint8_t) GLOBAL_MALLOC(READ_BUFFER_MAX_SIZE * sizeof(uint8_t)); if (lineBuffer == NULL) goto exit_error;
// End
GLOBAL_FREEMEM(lineBuffer); return model;
exit_error: if (DEBUG_IED_SERVER) printf("IED_SERVER: error parsing line %i (indentation level = %i)\n", currentLine, indendation);