From c52e117797380d01e617b7cc3d9b4b2100e0dd93 Mon Sep 17 00:00:00 2001 From: Derek Slaughter Date: Tue, 23 Apr 2024 15:36:49 +0000 Subject: [PATCH 1/2] Fix crash at exit when using new Intel icx compiler The new icx compiler is a bit smarter about checking for memory errors and a new one was discovered which causes OpenFAST to crap when calling MAP_End. The error is due to the OutputList nodes containing pointers to memory which has already been freed. This is due to the way the OutputList is constructed where nodes from other lists (containing pointers to string memory) were appended without allocating new memory. So when the original list was freed, these pointers became invalid, but then the OutputList tried to free them again, resulting in a double free error. To fix this issue, set_output_list was changed to allocate new memory for copies of these nodes. --- modules/map/src/mapinit.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/map/src/mapinit.c b/modules/map/src/mapinit.c index 3afe39f3a4..b3a29f0191 100644 --- a/modules/map/src/mapinit.c +++ b/modules/map/src/mapinit.c @@ -2304,7 +2304,14 @@ MAP_ERROR_CODE push_variable_to_output_list(OutputList* y_list, const int i, dou size = list_size(&y_list->out_list_ptr); iter_vartype = (VarTypePtr*)list_get_at(&y_list->out_list_ptr, size-1); iter_vartype->value = variable_ref; - iter_vartype->name = bformat("%s[%d]", alias, i); + if (i >= 0) + { + iter_vartype->name = bformat("%s[%d]", alias, i); + } + else + { + iter_vartype->name = bformat(alias); + } iter_vartype->units = bformat("%s", units); return MAP_SAFE; @@ -2325,49 +2332,50 @@ MAP_ERROR_CODE set_output_list(Domain* domain, MAP_InitOutputType_t* io_type, ch line_iter = (Line*)list_iterator_next(&domain->line); if (line_iter->options.gx_anchor_pos_flag) { - list_append(&y_list->out_list_ptr, &line_iter->anchor->position_ptr.x); + success = push_variable_to_output_list(y_list, -1, line_iter->anchor->position_ptr.x.value, line_iter->anchor->position_ptr.x.name->data, line_iter->anchor->position_ptr.x.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; if (line_iter->options.gy_anchor_pos_flag) { - list_append(&y_list->out_list_ptr, &line_iter->anchor->position_ptr.y); + success = push_variable_to_output_list(y_list, -1, line_iter->anchor->position_ptr.x.value, line_iter->anchor->position_ptr.x.name->data, line_iter->anchor->position_ptr.x.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; if (line_iter->options.gz_anchor_pos_flag) { - list_append(&y_list->out_list_ptr, &line_iter->anchor->position_ptr.z); + success = push_variable_to_output_list(y_list, -1, line_iter->anchor->position_ptr.x.value, line_iter->anchor->position_ptr.x.name->data, line_iter->anchor->position_ptr.x.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; if (line_iter->options.gx_pos_flag) { list_append(&y_list->out_list_ptr, &line_iter->fairlead->position_ptr.x); + success = push_variable_to_output_list(y_list, -1, line_iter->fairlead->position_ptr.x.value, line_iter->fairlead->position_ptr.x.name->data, line_iter->fairlead->position_ptr.x.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; if (line_iter->options.gy_pos_flag) { - list_append(&y_list->out_list_ptr, &line_iter->fairlead->position_ptr.y); + success = push_variable_to_output_list(y_list, -1, line_iter->fairlead->position_ptr.y.value, line_iter->fairlead->position_ptr.y.name->data, line_iter->fairlead->position_ptr.y.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; if (line_iter->options.gz_pos_flag) { - list_append(&y_list->out_list_ptr, &line_iter->fairlead->position_ptr.z); + success = push_variable_to_output_list(y_list, -1, line_iter->fairlead->position_ptr.z.value, line_iter->fairlead->position_ptr.z.name->data, line_iter->fairlead->position_ptr.z.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; if (line_iter->options.H_flag) { - list_append(&y_list->out_list_ptr, &line_iter->H); + success = push_variable_to_output_list(y_list, -1, line_iter->H.value, line_iter->H.name->data, line_iter->H.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; if (line_iter->options.V_flag) { - list_append(&y_list->out_list_ptr, &line_iter->V); + success = push_variable_to_output_list(y_list, -1, line_iter->V.value, line_iter->V.name->data, line_iter->V.units->data); io_type->writeOutputHdr_Len++; io_type->writeOutputUnt_Len++; }; From 0f082260367d727c6b99e228349d4b19866a554a Mon Sep 17 00:00:00 2001 From: Derek Slaughter Date: Tue, 23 Apr 2024 16:19:32 +0000 Subject: [PATCH 2/2] Disable cache in setup-python GH action --- .github/workflows/automated-dev-tests.yml | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/automated-dev-tests.yml b/.github/workflows/automated-dev-tests.yml index 49e6882213..7ca5d3dffa 100644 --- a/.github/workflows/automated-dev-tests.yml +++ b/.github/workflows/automated-dev-tests.yml @@ -43,7 +43,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -128,7 +128,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -173,7 +173,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -226,7 +226,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -263,7 +263,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -300,7 +300,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -339,7 +339,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -400,7 +400,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -455,7 +455,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -513,7 +513,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -560,7 +560,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -612,7 +612,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -661,7 +661,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -710,7 +710,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -759,7 +759,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -808,7 +808,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -857,7 +857,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt @@ -906,7 +906,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Install dependencies run: | pip install -r requirements.txt