Skip to content

Matlab function not responding after certain times of calls. #255

@lshenglin

Description

@lshenglin

First of all, I have to say this python-matlab-bridge is great, very easy to use, very helpful examples. However I am met with this issue that I think has not been raised by other users. I'm trying to call a Matlab function over and over and I find it always fails at a certain numbers of calls. To illustrate, I attach the code and output below:
Code starts*************************
import sys
import os

from pymatbridge import Matlab

mlab = Matlab(executable='/Applications/MATLAB_R2017a.app/bin/matlab')
mlab.start()

matlab_call_cnt = 0

while True:
matlab_call_cnt+=1
print(matlab_call_cnt)
res = mlab.run_func('/Users/shenglinli/PycharmProjects/pymat_test/jk.m', {'arg1': 3, 'arg2': 5})
print(res['result'])
mlab.stop()
Code ends*************************

And it will print number of Matlab function calls and the result of the "jk.m" function which is 8. So it goes like:
Output starts*************************
Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge-849ff32d-88b6-4a38-8509-7f59d3a705c1
Send 'exit' command to kill the server
........MATLAB started and connected!
1
8
2
8
3
8
4
8
...
269
8
270
8
271
Output ends*************************
Basically I find that it always stuck at 271st call of Matlab function, 100% repeatable. It seems like python sends request to Matlab server and does not get a response on that function call. I'd really appreaciate it if someone can share some insight on this issue.

And below are my settings:
OSX
Matlab R2017a
Current libzmq version is 4.1.6
Current pyzmq version is 16.0.2

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions