Opened 8 years ago

Closed 19 months ago

#3981 closed defect (fixed)

Simulation crashes in libstdc++-6.dll using ExternalMedia

Reported by: Alexander Täschner <A.Taeschner@…> Owned by: Francesco Casella
Priority: critical Milestone:
Component: *unknown* Version:
Keywords: Cc: Francesco Casella

Description

I just tried the new Win32 build on Windows with an older model which workes fine using OpenModelica-v1.9.6. With omc and/or OmEdit from OpenModelica-v1.10.0-dev-655-gcf561f7-32bit the simulation crashes with Access violation in libstdc++-6.dll.

A total file and the used version of the ExternalMedia library is attached in the zip file.

Attachments (3)

Test_SVTotal.zip (1.4 MB ) - added by Alexander Täschner <A.Taeschner@…> 8 years ago.
Save total of the model and used lib.
Resources.zip (2.0 MB ) - added by Adrian Pop 8 years ago.
libExternalMedia.a compiled with gcc 5.3 32bit/64bit
Resources-gcc-5.3-EMr7886.zip (1.9 MB ) - added by Adrian Pop 8 years ago.

Change History (32)

by Alexander Täschner <A.Taeschner@…>, 8 years ago

Attachment: Test_SVTotal.zip added

Save total of the model and used lib.

comment:1 by Adrian Pop, 8 years ago

My feeling without testing is that libExternalMediaLib.a (which was compiled using gcc 4.4) needs to be recompiled with the new gcc 5.3 from OpenModelica-v1.10.0-dev-655-gcf561f7-32bit/tools/msys/mingw32.

comment:2 by Adrian Pop, 8 years ago

Seems that you're using coolprop with ExternalMedia, did you compiled it yourself, which version?

comment:3 by Alexander Täschner <A.Taeschner@…>, 8 years ago

I used the precompiled version from Github(https://github.com/modelica/ExternalMedia/tree/06b89b59fe3b17bf42062ec1bd23a3f8eda0396a) - with newer Github versions I had convergence issues with my problem. The only change is, that I defined an own HeliumMedium package with pre evaluated constants to make it faster.

comment:4 by Adrian Pop, 8 years ago

Cc: Francesco Casella added

The problem is that I need to recompile libExternalMediaLib.a with the GCC 5.3 we're now
using in OpenModelica and for that I need some version of the CoolProp sources (the master
from https://github.com/CoolProp has already too many changes to work with the sources from ExternalMedia). I'll ask Francesco what's the proper way to do this.

As far as I remember the already compiled libExternalMediaLib.a in ExternalMedia includes CoolProp inside it but things have changed quite a bit since then and CoolProp is separate now.

comment:5 by Alexander Täschner <A.Taeschner@…>, 8 years ago

As far as I could see from the subversion repo of ExternalMedia, the corresponding Coolprop files came from https://github.com/ibell/coolprop. Comparing the dates I would guess that it was build with the 4.2.3 release (https://github.com/ibell/coolprop/tree/43ed8a1f6093857d37d4c4838196c8d8ef9aec11).

comment:6 by Christoph <buchner@…>, 8 years ago

Apparently, the coolprop devs maintain their own, recently updated, copy of ExternalMedia here, maybe this should be used instead/in addition, or re-unified with the Modelica version?

by Adrian Pop, 8 years ago

Attachment: Resources.zip added

libExternalMedia.a compiled with gcc 5.3 32bit/64bit

comment:7 by Adrian Pop, 8 years ago

@Alexander: can you try to update the Resources directory inside ExternalMedia with the one attached?
I now compiled libExternalMedia.a with the GCC 5.3 for both win32 and win64.
You could also try and see if OpenModelica 64bit works now with the win64 libExternalMedia.a.

comment:8 by Adrian Pop, 8 years ago

Myself I tried with the 64bit OM and the latest ExternalMedia from:
https://svn.modelica.org/projects/ExternalMediaLibrary/trunk/
but got some convergence issues, I guess the ones you mentioned:

assert            | debug   | Number of steps in density_TP has exceeded 30 with inputs T=2.1768,p=137376,rho_guess=117.237 for fluid Helium
assert            | debug   | Number of steps in density_TP has exceeded 30 with inputs T=2.1768,p=137376,rho_guess=117.237 for fluid Helium
DASKR--  AT T (=R1) AND STEPSIZE H (=R2) THE
      In above,  R1 =  4.2538044259115E-003   R2 =  4.4705330242243E-018
DASKR--  NONLINEAR SYSTEM SOLVER COULD NOT CONVERGE
DASKR--  BECAUSE IRES WAS EQUAL TO MINUS ONE
stdout            | warning | A Modelica assert prevents the integrator to continue. For more information use -lv LOG_SOLVER
stdout            | warning | can't continue. time = 0.004254
stdout            | info    | model terminate | Integrator failed. | Simulation terminated at time 0.0042538

in reply to:  6 comment:9 by Adrian Pop, 8 years ago

Replying to Christoph <buchner@…>:

Apparently, the coolprop devs maintain their own, recently updated, copy of ExternalMedia here, maybe this should be used instead/in addition, or re-unified with the Modelica version?

Yes, I sow that. I will try to compile with CoolProp5 and see how is going but Francesco told me there were some bugs in it, so we'll see.

comment:10 by Christoph <buchner@…>, 8 years ago

Alright. It probably makes sense to unify the 3 different versions/repos (github/coolprop, github/modelica and svn.modelica) into one definitive repo.

Btw, Coolprop 6.0 is already out, maybe even try with that one?

in reply to:  7 ; comment:11 by Alexander Täschner <A.Taeschner@…>, 8 years ago

Replying to adrpo:

@Alexander: can you try to update the Resources directory inside ExternalMedia with the one attached?
I now compiled libExternalMedia.a with the GCC 5.3 for both win32 and win64.
You could also try and see if OpenModelica 64bit works now with the win64 libExternalMedia.a.

I just tried your compiled library with the 32bit version above. The simulation crashes again, but this time inside the simulation executable with a strange error (looking in the generated mini dump):

Unhandled exception at 0x00DBD19A (SIS100ProportionalSafetyValveLowPressure_total.exe) in WERF02E.tmp.mdmp: 0x40000015: %hs.

The call stack looks like this:

SIS100ProportionalSafetyValveLowPressure_total.exe!00dbd19a() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for SIS100ProportionalSafetyValveLowPressure_total.exe]
SIS100ProportionalSafetyValveLowPressure_total.exe!00dbda9d() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00dcf6d0() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!0093df8c() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!0092399c() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!009269b6() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!0091ed61() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00913e41() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004f7966() Unknown
msvcrt.dll!75fc9d45() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a7a895() Unknown
msvcrt.dll!75fc9d45() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a411a8() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a7173c() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a69e1d() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a6e372() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a4148e() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a3a5da() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00401ba0() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004027b9() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a3c543() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a52385() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a528a4() Unknown
msvcrt.dll!75fc9d45() Unknown
msvcrt.dll!75fcb1b0() Unknown
msvcrt.dll!75fcb17a() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004d55ec() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004013e2() Unknown
kernel32.dll!74f3338a() Unknown
ntdll.dll!774d9902() Unknown
ntdll.dll!774d98d5() Unknown

in reply to:  8 comment:12 by Alexander Täschner <A.Taeschner@…>, 8 years ago

Replying to adrpo:

Myself I tried with the 64bit OM and the latest ExternalMedia from:
https://svn.modelica.org/projects/ExternalMediaLibrary/trunk/
but got some convergence issues, I guess the ones you mentioned:

assert            | debug   | Number of steps in density_TP has exceeded 30 with inputs T=2.1768,p=137376,rho_guess=117.237 for fluid Helium
assert            | debug   | Number of steps in density_TP has exceeded 30 with inputs T=2.1768,p=137376,rho_guess=117.237 for fluid Helium
DASKR--  AT T (=R1) AND STEPSIZE H (=R2) THE
      In above,  R1 =  4.2538044259115E-003   R2 =  4.4705330242243E-018
DASKR--  NONLINEAR SYSTEM SOLVER COULD NOT CONVERGE
DASKR--  BECAUSE IRES WAS EQUAL TO MINUS ONE
stdout            | warning | A Modelica assert prevents the integrator to continue. For more information use -lv LOG_SOLVER
stdout            | warning | can't continue. time = 0.004254
stdout            | info    | model terminate | Integrator failed. | Simulation terminated at time 0.0042538

Yes, this is the same problem I encountered before. I have absoluteley no idea why the temperature value of 2.1768 is used (the helium starts in the pipes with an temperature of 4.49 K and is heated in the pipes - without heating/or with extremely low heating power the convergence issue disappeared).

in reply to:  11 comment:13 by Adrian Pop, 8 years ago

Replying to Alexander Täschner <A.Taeschner@…>:

Replying to adrpo:

@Alexander: can you try to update the Resources directory inside ExternalMedia with the one attached?
I now compiled libExternalMedia.a with the GCC 5.3 for both win32 and win64.
You could also try and see if OpenModelica 64bit works now with the win64 libExternalMedia.a.

I just tried your compiled library with the 32bit version above. The simulation crashes again, but this time inside the simulation executable with a strange error (looking in the generated mini dump):

Unhandled exception at 0x00DBD19A (SIS100ProportionalSafetyValveLowPressure_total.exe) in WERF02E.tmp.mdmp: 0x40000015: %hs.

The call stack looks like this:

SIS100ProportionalSafetyValveLowPressure_total.exe!00dbd19a() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for SIS100ProportionalSafetyValveLowPressure_total.exe]
SIS100ProportionalSafetyValveLowPressure_total.exe!00dbda9d() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00dcf6d0() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!0093df8c() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!0092399c() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!009269b6() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!0091ed61() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00913e41() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004f7966() Unknown
msvcrt.dll!75fc9d45() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a7a895() Unknown
msvcrt.dll!75fc9d45() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a411a8() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a7173c() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a69e1d() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a6e372() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a4148e() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a3a5da() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00401ba0() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004027b9() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a3c543() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a52385() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!00a528a4() Unknown
msvcrt.dll!75fc9d45() Unknown
msvcrt.dll!75fcb1b0() Unknown
msvcrt.dll!75fcb17a() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004d55ec() Unknown
SIS100ProportionalSafetyValveLowPressure_total.exe!004013e2() Unknown
kernel32.dll!74f3338a() Unknown
ntdll.dll!774d9902() Unknown
ntdll.dll!774d98d5() Unknown

Ah, I forgot I updated my GCC locally to 5.4, maybe that's the problem. I'll redo this with GCC 5.3 and upload a new Resources.zip.

by Adrian Pop, 8 years ago

comment:14 by Adrian Pop, 8 years ago

@Alexander: you can try with the new one: https://trac.openmodelica.org/OpenModelica/attachment/ticket/3981/Resources-gcc-5.3-EMr7886.zip
This one is really compiled with gcc 5.3 but I also use revision 7886 of ExternalMedia (so that you don't get conflicts between the Modelica library and the C library if I use the latest version).

comment:15 by Alexander Täschner <A.Taeschner@…>, 8 years ago

Using your newly compiled version (thank you very much for your efforts!) I sadly get the same exception:

Unhandled exception at 0x00DBC47A (SIS100ProportionalSafetyValveLowPressure_total.exe) in WERB342.tmp.mdmp: 0x40000015: %hs.

0x40000015 seems to be STATUS_FATAL_APP_EXIT and is generated by abort() commands. Any ideas how to proceed?

comment:16 by Alexander Täschner <A.Taeschner@…>, 8 years ago

I just tested your new version with the 64bit omc (OpenModelica-v1.10.0-dev-660-gc1cac0c-64bit). With this the simulation shows the convergence issues (inside CoolProp) described above, but no crash.

comment:17 by Francesco Casella, 8 years ago

Summary: Simulation crashes in libstdc++-6.dllSimulation crashes in libstdc++-6.dll using ExternalMedia

comment:18 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:19 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:20 by Francesco Casella, 7 years ago

See updates on https://github.com/modelica/ExternalMedia/wiki, and please report if this is still a problem after we issue the next release of ExternalMedia.

comment:21 by Francesco Casella, 7 years ago

Milestone: 1.12.01.13.0
Owner: changed from somebody to Francesco Casella
Priority: blockercritical
Status: newassigned

comment:22 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:23 by Adrien, 6 years ago

Hello everyone,

Has anybody found a way to make ExternalMedia library work properly with recent OpenModelica versions (1.12) ?

Thanks a lot,
Adrien

comment:24 by Francesco Casella, 6 years ago

It's been on my to-do list for quite some time, but I had higher priority stuff to do. I will have to solve this issue by the end of February, because I need it for a project. Please follow the progress on GitHub

comment:25 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:26 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:27 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:28 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

comment:29 by Francesco Casella, 19 months ago

Resolution: fixed
Status: assignedclosed

All issues fixed in 1.21.0 with ExternalMedia 3.3.2/4.0.0

Note: See TracTickets for help on using tickets.