Occasional infinite while loop in MATLAB engine package for Python when waiting for results

I am using Python 3.7 and compiled the Matlab engine package from Matlab 2020a on an Ubuntu 18.04 OS. I use Matlab package to run some Matlab functions within my Python program, usually everything works fine but sometimes my program gets stuck into an infinite loop waiting for a function to return the values from Matlab engine. Specifically, the program is stuck in the "wait()" function from "BaseFuture" class.
What is the reason for Matlab engine randomly stopping/hanging? Is there a way to solve this random behavior?
UPDATE: I have tried recompiling the package with Matlab 2021b, but I am observing the same behavior...
Following is an excerpt of the Python code from Matlab engine package that results in the infinite waiting loop:
def wait(self, timeout, wait_for_func):
...
time_slice = 1
if timeout is None:
result_ready = self.done()
while not result_ready:
result_ready = wait_for_func(self._future, time_slice)
...

Respuestas (0)

Categorías

Productos

Versión

R2021b

Preguntada:

el 7 de Oct. de 2021

Editada:

el 7 de Dic. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by