Skip to content

Connecting to non-existent channel in matlab "freezes" Matlab #125

@aswyatt

Description

@aswyatt

The following is really bad:

javaaddpath("ca-1.3.2-all.jar")

con = org.epics.ca.Context();
ch = org.epics.ca.Channels.create(con, "NON_EXISTANT_PV");

% You can do nothing from here on other than kill Matlab
ch.get()

ch.close()
con.close()

An alternative is to connect via async, but I'm not sure of the consequences of this:

%	Only do this once per Matlab session!
javaaddpath("ca-1.3.2-all.jar")

con = org.epics.ca.Context();

ch = con.createChannel("NON_EXISTANT_STRING_PV", java.lang.String().getClass());
ch.connectAsync();
pause(1)	%	There can be a better way of waiting for connection
if ~strcmp(ch.getConnectionState, "CONNECTED")
  warning("PV does not exist")
end

ch = con.createChannel("EXISTANT_STRING_PV", java.lang.String().getClass());
ch.connectAsync();
pause(1)	%	There can be a better way of waiting for connection
if ~strcmp(ch.getConnectionState(), "CONNECTED")
  warning("PV does not exist")
end

ch.get()

ch.close()
con.close()

However, the connect method should allow one to specify a timeout value (and not use an infinite timeout as default).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions