Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Update v8.2.1 -> v8.3.0 or later broke flowsheet calculation in automation mode due to solver timeout #498

Closed
ghost opened this issue Jun 27, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jun 27, 2023

My python script using Automation2 to calculate a flowsheet under Linux works using v8.2.1, but hangs for v8.3.0, v8.3.5, v8.4.7 and v8.5.0 for a long time and then prints

errors: The solver was unable to calculate the flowsheet within the specified timeout limit.
  at DWSIM.FlowsheetSolver.FlowsheetSolver.SolveFlowsheet (System.Object fobj, System.Int32 mode, System.Threading.CancellationTokenSource ts, System.Boolean frompgrid, System.Boolean Adjusting, System.Action FinishSuccess, System.Action FinishWithErrors, System.Action FinishAny, System.Boolean ChangeCalcOrder) [0x007bc] in <f917291992a84ddead00301c42a744c2>:0

The flowsheet calculates fine when opened in the cross-platform GUI in any version given above without any solver timeout issues. Looks like some solver setting is not initialised in automation mode which causes the solver to not converge.

To Reproduce
flowsheet_automation_bug.zip

  1. Use an installation of dwsim v8.2.1.
  2. Open 'myFlowsheet.dwxmz' in the dwsim GUI to verify it works.
  3. Run the attached calculateFlowsheet.py in the same directory as myFlowsheet.dwxmz
  4. The script should print this in the console:
Initializing DWSIM Automation Interface...
Could not set X locale modifiers
DWSIM Automation Interface initialized successfully.
Found myFlowsheet.dwxmz, loading this
Initializing the Flowsheet, please wait...
Loading Flowsheet data, please wait...
StateIn:
 pt = 1.77000000e+06, Tt = 1.37750000e+02, h     = -1.79485772e+02, s     = -1.68440713e+00
rho = 5.41834434e+01, mw = 2.89600000e+01, Z     = 8.26044787e-01
 cp = 1.27033209e+00, cv = 6.79969178e-01, cp/cv = 1.86822011e+00
massflow = 3.79450000e+01, ISA corrected massflow = 1.31159169e+00, molar flow    = 1.31025552e+03
liquid mole fraction = 0.00000000e+00, mass fraction = 0.00000000e+00
StateOut:
 pt = 5.83000000e+05, Tt = 1.02759159e+02, h     = -2.04402497e+02, s     = -1.62225087e+00
rho = 2.25369149e+01, mw = 2.89600000e+01, Z     = 8.76883881e-01
 cp = 1.14931392e+00, cv = 6.81801554e-01, cp/cv = 1.68570153e+00
massflow = 3.79450000e+01, ISA corrected massflow = 2.81511571e-01, molar flow    = 1.31025552e+03
liquid mole fraction = 0.00000000e+00, mass fraction = 0.00000000e+00
  1. Use an installation of dwsim v8.3.0 and perform the same steps. The script will print
Found myFlowsheet.dwxmz, loading this
errors: The solver was unable to calculate the flowsheet within the specified timeout limit.
  at DWSIM.FlowsheetSolver.FlowsheetSolver.SolveFlowsheet (System.Object fobj, System.Int32 mode, System.Threading.CancellationTokenSource ts, System.Boolean frompgrid, System.Boolean Adjusting, System.Action FinishSuccess, System.Action FinishWithErrors, System.Action FinishAny, System.Boolean ChangeCalcOrder) [0x007bc] in <f917291992a84ddead00301c42a744c2>:0 
StateIn:
 pt = 1.77000000e+06, Tt = 1.37750000e+02, h     = -1.79485772e+02, s     = -1.68440713e+00
rho = 5.41834434e+01, mw = 2.89600000e+01, Z     = 8.26044787e-01
 cp = 1.27033209e+00, cv = 6.79969178e-01, cp/cv = 1.86822011e+00
massflow = 3.79450000e+01, ISA corrected massflow = 1.31159169e+00, molar flow    = 1.31025552e+03
liquid mole fraction = 0.00000000e+00, mass fraction = 0.00000000e+00
StateOut:
 pt = 5.83000000e+05, Tt = 1.02759159e+02, h     = -2.04402497e+02, s     = -1.62225087e+00
rho = 2.25369149e+01, mw = 2.89600000e+01, Z     = 8.76883881e-01
 cp = 1.14931392e+00, cv = 6.81801554e-01, cp/cv = 1.68570153e+00
massflow = 3.79450000e+01, ISA corrected massflow = 2.81511571e-01, molar flow    = 1.31025552e+03
liquid mole fraction = 0.00000000e+00, mass fraction = 0.00000000e+00

before hanging indefinetely. The states printed are already in the flow sheet before calculation. Note the missing lines

Initializing DWSIM Automation Interface...
Could not set X locale modifiers
DWSIM Automation Interface initialized successfully.

and

Initializing the Flowsheet, please wait...
Loading Flowsheet data, please wait...

compared to the v8.2.1 output.

Expected behavior
The script should work for all versions of dwsim.

Desktop (please complete the following information):
I am using dwsim under Debian 11.
`mono --version
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-3.3~deb11u1 Sat Feb 18 21:26:37 UTC 2023)

but my feeling is that this is a true code bug and not an environment bug. If you need to setup a Linux test machine, I can provide you with a script that takes care of all the mono and python3 installation hassle.

@ghost ghost added the bug Something isn't working label Jun 27, 2023
@einhander
Copy link

einhander commented Jun 27, 2023

Hi @adwjpaul I run your code on my laptop with debian testing, I have segfault with following output:

Click me
=================================================================
	Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Native stacktrace:
=================================================================
	0x7f41fab427cb - /lib/libmonosgen-2.0.so.1 : 
	0x7f41fab42b69 - /lib/libmonosgen-2.0.so.1 : 
	0x7f41faacca5f - /lib/libmonosgen-2.0.so.1 : 
	0x7f41faa36340 - /lib/libmonosgen-2.0.so.1 : 
	0x7f41fbe02f90 - /lib/x86_64-linux-gnu/libc.so.6 : 
	0x7f41fab3e69b - /lib/libmonosgen-2.0.so.1 : 
	0x7f41faad1e5d - /lib/libmonosgen-2.0.so.1 : 
	0x7f41faa367e5 - /lib/libmonosgen-2.0.so.1 : 
	0x7f41fac4b44f - /lib/libmonosgen-2.0.so.1 : 
	0x7f41fac4ec2f - /lib/libmonosgen-2.0.so.1 : 
	0x7f41faba276b - /lib/libmonosgen-2.0.so.1 : 
	0x7f41faa382ed - /lib/libmonosgen-2.0.so.1 : 
	0x7f41faa99d0c - /lib/libmonosgen-2.0.so.1 : mono_jit_init
	0x7f41fb4af052 - /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/../../libffi.so.8 : 
	0x7f41fb4ad925 - /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/../../libffi.so.8 : 
	0x7f41fb4ae06e - /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/../../libffi.so.8 : ffi_call
	0x7f41fb4d3a14 - /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/_cffi_backend.cpython-310-x86_64-linux-gnu.so : 
	0x4f64bb - python3 : _PyObject_MakeTpCall
	0x4f2705 - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4ee6e0 - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4f5a3d - python3 : _PyObject_FastCallDictTstate
	0x505fb8 - python3 : 
	0x4f650b - python3 : _PyObject_MakeTpCall
	0x4f29f7 - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4efeac - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4ed64f - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4ed64f - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4ed64f - python3 : _PyEval_EvalFrameDefault
	0x592912 - python3 : 
	0x592857 - python3 : PyEval_EvalCode
	0x599d4d - python3 : 
	0x4fd064 - python3 : 
	0x4f2e27 - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4f1e5d - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4eda5e - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4ed64f - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4ed64f - python3 : _PyEval_EvalFrameDefault
	0x4fce7f - python3 : _PyFunction_Vectorcall
	0x4fc644 - python3 : 
	0x50ae71 - python3 : _PyObject_CallMethodIdObjArgs
	0x50a26e - python3 : PyImport_ImportModuleLevelObject
	0x4f0873 - python3 : _PyEval_EvalFrameDefault
	0x592912 - python3 : 
	0x592857 - python3 : PyEval_EvalCode
	0x5c34a7 - python3 : 
	0x5be5e0 - python3 : 
	0x459935 - python3 : 
	0x5b8b6f - python3 : _PyRun_SimpleFileObject
	0x5b88d3 - python3 : _PyRun_AnyFileObject
	0x5b568d - python3 : Py_RunMain
	0x5859c9 - python3 : Py_BytesMain
	0x7f41fbdee18a - /lib/x86_64-linux-gnu/libc.so.6 : 
	0x7f41fbdee245 - /lib/x86_64-linux-gnu/libc.so.6 : __libc_start_main
	0x58587e - python3 : 

=================================================================
	Telemetry Dumper:
=================================================================
No threads attached to runtime.

=================================================================
	External Debugger Dump:
=================================================================
[New LWP 329109]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f41fbe9aa17 in __GI___wait4 (pid=329111, stat_loc=0x7ffdf9973254, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
30	../sysdeps/unix/sysv/linux/wait4.c: Нет такого файла или каталога.
  Id   Target Id                                        Frame 
* 1    Thread 0x7f41fbdc6500 (LWP 329106) "python3"     0x00007f41fbe9aa17 in __GI___wait4 (pid=329111, stat_loc=0x7ffdf9973254, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
  2    Thread 0x7f41fa3ff6c0 (LWP 329109) "SGen worker" __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x7f41fae9f1c8) at ./nptl/futex-internal.c:57

Thread 2 (Thread 0x7f41fa3ff6c0 (LWP 329109) "SGen worker"):
#0  __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x7f41fae9f1c8) at ./nptl/futex-internal.c:57
#1  __futex_abstimed_wait_common (futex_word=futex_word@entry=0x7f41fae9f1c8, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0, cancel=cancel@entry=true) at ./nptl/futex-internal.c:87
#2  0x00007f41fbe4cd9b in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f41fae9f1c8, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ./nptl/futex-internal.c:139
#3  0x00007f41fbe4f3f8 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f41fae9f1e0, cond=0x7f41fae9f1a0) at ./nptl/pthread_cond_wait.c:503
#4  ___pthread_cond_wait (cond=0x7f41fae9f1a0, mutex=0x7f41fae9f1e0) at ./nptl/pthread_cond_wait.c:618
#5  0x00007f41fad030b6 in ?? () from /lib/libmonosgen-2.0.so.1
#6  0x00007f41fbe4ffd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#7  0x00007f41fbed05bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 1 (Thread 0x7f41fbdc6500 (LWP 329106) "python3"):
#0  0x00007f41fbe9aa17 in __GI___wait4 (pid=329111, stat_loc=0x7ffdf9973254, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f41fab42a5b in ?? () from /lib/libmonosgen-2.0.so.1
#2  0x00007f41fab42b69 in ?? () from /lib/libmonosgen-2.0.so.1
#3  0x00007f41faacca5f in ?? () from /lib/libmonosgen-2.0.so.1
#4  0x00007f41faa36340 in ?? () from /lib/libmonosgen-2.0.so.1
#5  <signal handler called>
#6  0x00007f41fab3e69b in ?? () from /lib/libmonosgen-2.0.so.1
#7  0x00007f41faad1e5d in ?? () from /lib/libmonosgen-2.0.so.1
#8  0x00007f41faa367e5 in ?? () from /lib/libmonosgen-2.0.so.1
#9  0x00007f41fac4b44f in ?? () from /lib/libmonosgen-2.0.so.1
#10 0x00007f41fac4ec2f in ?? () from /lib/libmonosgen-2.0.so.1
#11 0x00007f41faba276b in ?? () from /lib/libmonosgen-2.0.so.1
#12 0x00007f41faa382ed in ?? () from /lib/libmonosgen-2.0.so.1
#13 0x00007f41faa99d0c in mono_jit_init () from /lib/libmonosgen-2.0.so.1
#14 0x00007f41fb4af052 in ffi_call_unix64 () from /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/../../libffi.so.8
#15 0x00007f41fb4ad925 in ffi_call_int () from /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/../../libffi.so.8
#16 0x00007f41fb4ae06e in ffi_call () from /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/../../libffi.so.8
#17 0x00007f41fb4d3a14 in cdata_call () from /home/einhander/miniconda3/envs/ct-env/lib/python3.10/site-packages/_cffi_backend.cpython-310-x86_64-linux-gnu.so
#18 0x00000000004f64bb in _PyObject_MakeTpCall (tstate=0x1dcfab0, callable=callable@entry=0x7f41fb2b6bb0, args=args@entry=0x1f3b5b8, nargs=<optimized out>, keywords=keywords@entry=0x0) at /usr/local/src/conda/python-3.10.11/Objects/call.c:215
#19 0x00000000004f2705 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x1f3b5b8, callable=0x7f41fb2b6bb0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:112
#20 _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x1f3b5b8, callable=0x7f41fb2b6bb0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:99
#21 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x1f3b5b8, callable=0x7f41fb2b6bb0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#22 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf9974c10, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#23 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x1f3b3c0, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4181
#24 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x1f3b3c0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#25 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb595880, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#26 _PyFunction_Vectorcall (func=0x7f41fb595870, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#27 0x00000000004ee6e0 in _PyObject_VectorcallTstate (kwnames=0x7f41fb53de70, nargsf=<optimized out>, args=<optimized out>, callable=0x7f41fb595870, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#28 PyObject_Vectorcall (kwnames=0x7f41fb53de70, nargsf=<optimized out>, args=<optimized out>, callable=0x7f41fb595870) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#29 call_function (kwnames=0x7f41fb53de70, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf9974dd0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#30 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x2017920, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4231
#31 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x2017920, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#32 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb44dbe0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#33 _PyFunction_Vectorcall (func=0x7f41fb44dbd0, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#34 0x00000000004f5a3d in _PyObject_FastCallDictTstate (tstate=0x1dcfab0, callable=0x7f41fb44dbd0, args=<optimized out>, nargsf=<optimized out>, kwargs=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:153
#35 0x0000000000505fb8 in _PyObject_Call_Prepend (kwargs=0x7f41fb41e080, args=0x7f41fb904070, obj=<optimized out>, callable=0x7f41fb44dbd0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Objects/call.c:431
#36 slot_tp_init (self=<optimized out>, args=<optimized out>, kwds=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/typeobject.c:7734
#37 0x00000000004f650b in type_call (kwds=0x7f41fb41e080, args=0x7f41fb904070, type=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/typeobject.c:1135
#38 _PyObject_MakeTpCall (tstate=tstate@entry=0x1dcfab0, callable=callable@entry=0x2000f10, args=<optimized out>, nargs=<optimized out>, keywords=keywords@entry=0x7f41fb771460) at /usr/local/src/conda/python-3.10.11/Objects/call.c:215
#39 0x00000000004f29f7 in _PyObject_VectorcallTstate (kwnames=0x7f41fb771460, nargsf=<optimized out>, args=<optimized out>, callable=0x2000f10, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:112
#40 _PyObject_VectorcallTstate (kwnames=0x7f41fb771460, nargsf=<optimized out>, args=<optimized out>, callable=0x2000f10, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:99
#41 PyObject_Vectorcall (kwnames=0x7f41fb771460, nargsf=<optimized out>, args=<optimized out>, callable=0x2000f10) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#42 call_function (kwnames=0x7f41fb771460, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf99750f0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#43 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x1eaf440, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4231
#44 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x1eaf440, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#45 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb7d8200, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#46 _PyFunction_Vectorcall (func=0x7f41fb7d81f0, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#47 0x00000000004efeac in do_call_core (kwdict=0x7f41fb789380, callargs=0x7f41fb904070, func=0x7f41fb7d81f0, trace_info=0x7ffdf99752b0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5945
#48 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb9bcfc0, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4277
#49 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb9bcfc0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#50 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb595520, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#51 _PyFunction_Vectorcall (func=0x7f41fb595510, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#52 0x00000000004ed64f in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8bdfc0, callable=0x7f41fb595510, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#53 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8bdfc0, callable=0x7f41fb595510) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#54 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf9975470, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#55 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb8bde40, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4213
#56 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb8bde40, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#57 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb5955b0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#58 _PyFunction_Vectorcall (func=0x7f41fb5955a0, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#59 0x00000000004ed64f in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8bd7d8, callable=0x7f41fb5955a0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#60 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8bd7d8, callable=0x7f41fb5955a0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#61 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf9975630, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#62 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb8bd640, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4213
#63 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb8bd640, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#64 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb595640, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#65 _PyFunction_Vectorcall (func=0x7f41fb595630, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#66 0x00000000004ed64f in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb92e188, callable=0x7f41fb595630, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#67 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb92e188, callable=0x7f41fb595630) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#68 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf99757f0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#69 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb92e020, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4213
#70 0x0000000000592912 in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb92e020, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#71 _PyEval_Vector (tstate=tstate@entry=0x1dcfab0, con=con@entry=0x7ffdf99758f0, locals=locals@entry=0x7f41fb7657c0, args=args@entry=0x0, argcount=argcount@entry=0, kwnames=kwnames@entry=0x0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#72 0x0000000000592857 in PyEval_EvalCode (co=co@entry=0x7f41fb75ae40, globals=globals@entry=0x7f41fb7657c0, locals=locals@entry=0x7f41fb7657c0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:1134
#73 0x0000000000599d4d in builtin_exec_impl (module=<optimized out>, locals=0x7f41fb7657c0, globals=0x7f41fb7657c0, source=0x7f41fb75ae40) at /usr/local/src/conda/python-3.10.11/Python/bltinmodule.c:1058
#74 builtin_exec (module=<optimized out>, args=args@entry=0x7f41fb764818, nargs=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/clinic/bltinmodule.c.h:371
#75 0x00000000004fd064 in cfunction_vectorcall_FASTCALL (func=0x7f41fb998e00, args=0x7f41fb764818, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/methodobject.c:430
#76 0x00000000004f2e27 in do_call_core (kwdict=0x7f41fb789140, callargs=0x7f41fb764800, func=0x7f41fb998e00, trace_info=0x7ffdf9975ac0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5917
#77 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb74c040, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4277
#78 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb74c040, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#79 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb961520, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#80 _PyFunction_Vectorcall (func=0x7f41fb961510, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#81 0x00000000004f1e5d in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb730a88, callable=0x7f41fb961510, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#82 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb730a88, callable=0x7f41fb961510) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#83 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf9975c80, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#84 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb730900, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4181
#85 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb730900, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#86 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb9e5640, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#87 _PyFunction_Vectorcall (func=0x7f41fb9e5630, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#88 0x00000000004eda5e in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x1eafd90, callable=0x7f41fb9e5630, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#89 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x1eafd90, callable=0x7f41fb9e5630) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#90 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf9975e40, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#91 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x1eafc10, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4198
#92 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x1eafc10, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#93 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb9620f0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#94 _PyFunction_Vectorcall (func=0x7f41fb9620e0, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#95 0x00000000004ed64f in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8be1f0, callable=0x7f41fb9620e0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#96 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8be1f0, callable=0x7f41fb9620e0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#97 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf9976000, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#98 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb8be040, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4213
#99 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb8be040, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#100 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb9632f0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#101 _PyFunction_Vectorcall (func=0x7f41fb9632e0, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#102 0x00000000004ed64f in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8bddd0, callable=0x7f41fb9632e0, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#103 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7f41fb8bddd0, callable=0x7f41fb9632e0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:123
#104 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7ffdf99761c0, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5893
#105 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb8bdc40, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:4213
#106 0x00000000004fce7f in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb8bdc40, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#107 _PyEval_Vector (kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, locals=0x0, con=0x7f41fb963380, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#108 _PyFunction_Vectorcall (func=0x7f41fb963370, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:342
#109 0x00000000004fc644 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7ffdf9976300, callable=0x7f41fb963370, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/cpython/abstract.h:114
#110 object_vacall (tstate=tstate@entry=0x1dcfab0, base=0x7ffdf9976300, base@entry=0x0, callable=0x7f41fb963370, vargs=<optimized out>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:734
#111 0x000000000050ae71 in _PyObject_CallMethodIdObjArgs (obj=0x0, name=name@entry=0x73c9e0 <PyId__find_and_load.6>) at /usr/local/src/conda/python-3.10.11/Objects/call.c:824
#112 0x000000000050a26e in import_find_and_load (abs_name=0x7f41fb889830, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Python/import.c:1522
#113 PyImport_ImportModuleLevelObject (name=name@entry=0x7f41fb889830, globals=<optimized out>, locals=<optimized out>, fromlist=fromlist@entry=0x744720 <_Py_NoneStruct>, level=0) at /usr/local/src/conda/python-3.10.11/Python/import.c:1623
#114 0x00000000004f0873 in import_name (level=0x7f41fb9000d0, fromlist=0x744720 <_Py_NoneStruct>, name=0x7f41fb889830, f=0x7f41fb929a40, tstate=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:6018
#115 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x7f41fb929a40, throwflag=<optimized out>) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:3695
#116 0x0000000000592912 in _PyEval_EvalFrame (throwflag=0, f=0x7f41fb929a40, tstate=0x1dcfab0) at /usr/local/src/conda/python-3.10.11/Include/internal/pycore_ceval.h:46
#117 _PyEval_Vector (tstate=tstate@entry=0x1dcfab0, con=con@entry=0x7ffdf99766f0, locals=locals@entry=0x7f41fb83d380, args=args@entry=0x0, argcount=argcount@entry=0, kwnames=kwnames@entry=0x0) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:5067
#118 0x0000000000592857 in PyEval_EvalCode (co=co@entry=0x7f41fb8fb5d0, globals=globals@entry=0x7f41fb83d380, locals=locals@entry=0x7f41fb83d380) at /usr/local/src/conda/python-3.10.11/Python/ceval.c:1134
#119 0x00000000005c34a7 in run_eval_code_obj (tstate=tstate@entry=0x1dcfab0, co=co@entry=0x7f41fb8fb5d0, globals=globals@entry=0x7f41fb83d380, locals=locals@entry=0x7f41fb83d380) at /usr/local/src/conda/python-3.10.11/Python/pythonrun.c:1291
#120 0x00000000005be5e0 in run_mod (mod=mod@entry=0x1eb1220, filename=filename@entry=0x7f41fb88e030, globals=globals@entry=0x7f41fb83d380, locals=locals@entry=0x7f41fb83d380, flags=flags@entry=0x7ffdf99768e8, arena=arena@entry=0x7f41fb903b90) at /usr/local/src/conda/python-3.10.11/Python/pythonrun.c:1312
#121 0x0000000000459935 in pyrun_file (fp=fp@entry=0x1dd46a0, filename=filename@entry=0x7f41fb88e030, start=start@entry=257, globals=globals@entry=0x7f41fb83d380, locals=locals@entry=0x7f41fb83d380, closeit=closeit@entry=1, flags=0x7ffdf99768e8) at /usr/local/src/conda/python-3.10.11/Python/pythonrun.c:1208
#122 0x00000000005b8b6f in _PyRun_SimpleFileObject (fp=0x1dd46a0, filename=0x7f41fb88e030, closeit=1, flags=0x7ffdf99768e8) at /usr/local/src/conda/python-3.10.11/Python/pythonrun.c:456
#123 0x00000000005b88d3 in _PyRun_AnyFileObject (fp=0x1dd46a0, filename=filename@entry=0x7f41fb88e030, closeit=closeit@entry=1, flags=flags@entry=0x7ffdf99768e8) at /usr/local/src/conda/python-3.10.11/Python/pythonrun.c:90
#124 0x00000000005b568d in pymain_run_file_obj (skip_source_first_line=0, filename=0x7f41fb88e030, program_name=0x7f41fb8a24b0) at /usr/local/src/conda/python-3.10.11/Modules/main.c:357
#125 pymain_run_file (config=0x1db3f90) at /usr/local/src/conda/python-3.10.11/Modules/main.c:376
#126 pymain_run_python (exitcode=0x7ffdf99768e0) at /usr/local/src/conda/python-3.10.11/Modules/main.c:591
#127 Py_RunMain () at /usr/local/src/conda/python-3.10.11/Modules/main.c:670
#128 0x00000000005859c9 in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at /usr/local/src/conda/python-3.10.11/Modules/main.c:1090
#129 0x00007f41fbdee18a in __libc_start_call_main (main=main@entry=0x585980 <main>, argc=argc@entry=2, argv=argv@entry=0x7ffdf9976b18) at ../sysdeps/nptl/libc_start_call_main.h:58
#130 0x00007f41fbdee245 in __libc_start_main_impl (main=0x585980 <main>, argc=2, argv=0x7ffdf9976b18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffdf9976b08) at ../csu/libc-start.c:381
#131 0x000000000058587e in _start ()
[Inferior 1 (process 329106) detached]

=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7f41fab3e69b):0x7f41fab3e68b  83 c2 01 48 83 fa 01 0f 87 b5 00 00 00 83 e8 05  ...H............
0x7f41fab3e69b  c6 03 e8 89 43 01 4d 85 e4 74 52 c6 43 05 08 4c  ....C.M..tR.C..L
0x7f41fab3e6ab  8d 63 0e 4c 89 6b 06 49 29 dc 48 63 c5 49 39 c4  .c.L.k.I).Hc.I9.
0x7f41fab3e6bb  7f 53 4d 85 ff 74 03 41 89 2f 89 ee 48 89 df e8  .SM..t.A./..H...

I think its a bug in mono.

@ghost
Copy link
Author

ghost commented Jun 27, 2023

What is Debian testing? Debian 12 Bookworm was just released, so I am not sure what your system looks like.

However: Does the code run using dwsim v8.2.1? Have you been able to run any python scripts using dwsim and Automation2?

I see a lot of conda-related paths in your output, so your python environment is likely very different from mine. I made sure to deviate as little as possible from the official Debian repositories. For completenes' sake, here is the script I used for setting up dwsim:

#! /bin/bash

echo "Installing dwsim using provided .deb file ${1} (right?!)"

## Install mono=6.8.0 and all of its dependencies from the standard debian repository
apt-get install -y  mono-complete

# Now set up the mono-official repository. This contains mono-6.12, which does not work with dwsim
# So we use this only for getting mono-vbnc and the like
# Install prerequisites for getting the key
apt-get install -y dirmngr gnupg apt-transport-https ca-certificates
# Get key used for signing the mono repository packages
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# Add mono repository
echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list
apt update

# Install deb file without resolving dependencies
dpkg -i ${1}
# Now install the dependencies. If the resolution is to remove dwsim again, some package is unavailable
apt --fix-broken install

# Now deactivate mono repository again so apt upgrade does not kill our mono-6.8.0 installation
echo "#deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list
apt update

# We need pythonnet available only through pip3, yuck!
apt-get install -y python3-pip python3-pypdf2

# The dist-packages folder is not accessible to normal users, so chgrp it

chgrp -R users /usr/local/lib/python3.9/dist-packages

# Not all versions of pythonnet and clr_loader work, these are versions that work!
pip3 install pythonnet==3.0.0a2 clr_loader==0.1.7

@DanWBR
Copy link
Owner

DanWBR commented Jun 27, 2023

@adwjpaul try using Automation3() and see what happens. It seems to be something related to the Python/C# interface.

@ghost
Copy link
Author

ghost commented Jun 28, 2023

Yes, using Automation3 makes the whole thing work again. I must admit that I was not aware of Automation3, is Automation2 deprecated?

@DanWBR
Copy link
Owner

DanWBR commented Jun 28, 2023

@adwjpaul Automation() and Automation2() are based on the Classic and Cross-Platform UI versions respectively. Every time you create a new flowsheet using these interfaces, the whole GUI was being created in the background, but not shown to you. Slow and heavy on resources. Automation3() is designed to be GUI-less and consumes a minimal amount of memory. I'm not doing anything with Automation() and Automation2() anymore, to be honest.

@DanWBR DanWBR closed this as completed Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants