channelaccess / ca_matlab

4 stars 2 forks source link

Error during execution #12

Open aswyatt opened 7 years ago

aswyatt commented 7 years ago

I followed the example and obtain an error when the channel is created. However, the error does not reoccur if I create new channels (unless I restart Matlab) and I am able to communicate with the EPICS server using the channel get/set commands.

I am running EPICS 3.16 on ubuntu inside virtual box with a bridged network adapter.

Matlab version is:

MATLAB Version: 9.2.0.538062 (R2017a) MATLAB License Number: 916029 Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 14393) Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

Java version in Matalab:

Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

Code I used:

javaaddpath('ca_matlab.jar');
P = java.util.Properties();
P.setProperty('EPICS_CA_ADDR_LIST', '192.168.0.11');
C = ch.psi.jcae.Context(P);
D = ch.psi.jcae.ChannelDescriptor('string', 'TEST_IOC:MY_STRING');
CH = ch.psi.jcae.Channels.create(C, D);

Error I got:

Failed to exec 'C:\Program Files\MATLAB\R2017a\sys\java\jre\win64\jre\bin\java', trying to start native repeater... Jul 30, 2017 5:32:15 AM com.cosylab.epics.caj.CARepeater$1 run

SEVERE: Failed to exec 'C:\Program Files\MATLAB\R2017a\sys\java\jre\win64\jre\bin\java', trying to start native repeater...

java.io.IOException: Cannot run program "C:\Program Files\MATLAB\R2017a\sys\java\jre\win64\jre\bin\java": CreateProcess error=206, The filename or extension is too long

at java.lang.ProcessBuilder.start(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at com.cosylab.epics.caj.CARepeater$1.run(CARepeater.java:629)

at java.security.AccessController.doPrivileged(Native Method)

at com.cosylab.epics.caj.CARepeater.startRepeater(CARepeater.java:647)

at com.cosylab.epics.caj.CAJContext.internalInitialize(CAJContext.java:673)

at com.cosylab.epics.caj.CAJContext.initialize(CAJContext.java:661)

at com.cosylab.epics.caj.CAJContext.checkState(CAJContext.java:644)

at com.cosylab.epics.caj.CAJContext.createChannel(CAJContext.java:908)

at gov.aps.jca.Context.createChannel(Context.java:143)

at ch.psi.jcae.impl.JCAChannelFactory.createChannel(JCAChannelFactory.java:80)

at ch.psi.jcae.impl.DefaultChannelService.createChannel(DefaultChannelService.java:119)

at ch.psi.jcae.Channels.create(Channels.java:47)

Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long

at java.lang.ProcessImpl.create(Native Method)

at java.lang.ProcessImpl.(Unknown Source)

at java.lang.ProcessImpl.start(Unknown Source)

... 14 more

Jul 30, 2017 5:32:16 AM com.cosylab.epics.caj.impl.BroadcastTransport send

SEVERE:

java.net.BindException: Cannot assign requested address: no further information

at sun.nio.ch.DatagramChannelImpl.send0(Native Method)

at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(Unknown Source)

at sun.nio.ch.DatagramChannelImpl.send(Unknown Source)

at sun.nio.ch.DatagramChannelImpl.send(Unknown Source)

at com.cosylab.epics.caj.impl.BroadcastTransport.send(BroadcastTransport.java:238)

at com.cosylab.epics.caj.impl.ChannelSearchManager.flushSendBuffer(ChannelSearchManager.java:556)

at com.cosylab.epics.caj.impl.ChannelSearchManager.access$600(ChannelSearchManager.java:31)

at com.cosylab.epics.caj.impl.ChannelSearchManager$SearchTimer.timeout(ChannelSearchManager.java:335)

at com.cosylab.epics.caj.util.Timer$RunLoop.run(Timer.java:276)

at java.lang.Thread.run(Unknown Source)

simongregorebner commented 7 years ago

Unfortunately we have no Windows 10 machine around right now to reproduce and see this error. Therefore debugging this might take some time.

However the issue is that the current version of this library tries to start the native channel access repeater which apparently fails for some reasons on your Windows. (I will try to figure out why once I got a Windows 10 machine)

For what the repeater is required for is described at http://www.aps.anl.gov/epics/docs/CAproto.html in Section 1.2.5. Repeater (it is basically required if you have more than one client on your machine)

simongregorebner commented 7 years ago

Just a sidemark, if you have a Java 8 available on your Machine you could give the newer version of "this" library a try https://github.com/channelaccess/ca/blob/master/ReadmeMatlab.md (thats the Matlab channel access library we use at PSI if the machine has a Java 8 available). This one comes with a build in repeater so it shouldn't face the issues.

The usage is more or less the same except that the import is import org.epics.ca (Make sure you download the all package https://github.com/channelaccess/ca/releases/download/1.0.1/ca-all-1.0.1.jar so that you have all the dependencies of it already)

aswyatt commented 7 years ago

Thanks for the update. Just to clarify, I do not have EPICS base, or channel access, installed in the windows machine - the idea is to minimise the number of dependencies to enable CA in Matlab. So essentially the procedure is take a fresh copy of Windows 10, install Matlab, download ca_matlab and then run. Please let me know if I'm missing something.

I tried using the Java 8 approach, but seem to be getting the same results:

MATLAB_JAVA=C:\Program Files\Java\jre1.8.0_144

In MATLAB: version -java

Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

javaaddpath('ca-all-1.0.1.jar')
P = java.util.Properties();
P.setProperty(javaMethod('toString', javaMethod('valueOf', 'org.epics.ca.Context$Configuration', 'EPICS_CA_ADDR_LIST')), '130.246.68.120');
C = org.epics.ca.Context(P); % This generates error 1 below
CH = org.epics.ca.Channels.create(C, 'STR'); % This generates error 2 below
CH.get; % This returns the value of the string in STR

Error 1 (from context generation)

Failed to exec 'C:\Program Files\Java\jre1.8.0_144\bin\java', trying to start native repeater... Aug 03, 2017 2:41:40 PM org.epics.ca.impl.repeater.CARepeater$1 run

SEVERE: Failed to exec 'C:\Program Files\Java\jre1.8.0_144\bin\java', trying to start native repeater...

java.io.IOException: Cannot run program "C:\Program Files\Java\jre1.8.0_144\bin\java": CreateProcess error=206, The filename or extension is too long

at java.lang.ProcessBuilder.start(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at org.epics.ca.impl.repeater.CARepeater$1.run(CARepeater.java:586)

at java.security.AccessController.doPrivileged(Native Method)

at org.epics.ca.impl.repeater.CARepeater.startRepeater(CARepeater.java:604)

at org.epics.ca.impl.ContextImpl.(ContextImpl.java:239)

at org.epics.ca.Context.(Context.java:22)

Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long

at java.lang.ProcessImpl.create(Native Method)

at java.lang.ProcessImpl.(Unknown Source)

at java.lang.ProcessImpl.start(Unknown Source)

... 8 more

Error 2 (from channel creation)

Aug 03, 2017 2:41:47 PM org.epics.ca.impl.ResponseHandlers exceptionResponse

WARNING: Exception message reported, code: DEFUNCT, message: 'CAS: Client version 0 too old'.

On the EPICS IOC it displays this error when the channel was created (CH = org.epics.ca.Channels.create(...))

epics> CAS: request from 130.246.243.48:56127 => CAS: Client version too old CAS: Request from 130.246.243.48:56127 => cmmd=23 cid=0x0 type=0 count=0 postsize=0 CAS: Request from 130.246.243.48:56127 => available=0x0 N=0 paddr=(nil)

simongregorebner commented 7 years ago

Thanks for the update and more details! You don't need epics base on the windows machine. To minimise the dependencies was actually exactly the reason for this lib. I will try to get a windows 10 machine as soon as possible to try to reproduce this issue.

aswyatt commented 7 years ago

Thanks – you can email me directly on adam.wyatt@stfc.ac.uk

The CA seems to function okay after the error, and the error doesn’t seem to repeat. I even tried multiple instances of Matlab without additional issues. However, I haven’t yet tested things extensively, so other issues may arise.

FYI – I get the same result on Windows 7

Your help is much appreciated – let me know how you get on.

Dr Adam S Wyatt Senior Ultrafast Laser Scientist

Central Laser Facility STFC Rutherford Appleton Laboratory Harwell Campus, Didcot, OX11 0QX, UK Tel: +44 (0)1235 778841

From: Simon Gregor Ebner Sent: 03 August 2017 15:02 To: channelaccess/ca_matlab Cc: wybird666; Author Subject: Re: [channelaccess/ca_matlab] Error during execution (#12)

Thanks for the update and more details! You don't need epics base on the windows machine. To minimise the dependencies was actually exactly the reason for this lib. I will try to get a windows 10 machine as soon as possible to try to reproduce this issue. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

simongregorebner commented 7 years ago

sorry I still did not get any hold on a windows 10 machine in our lab.

aswyatt commented 7 years ago

Thanks for keeping me updated.

I do have one particular question – how can one force a PV to be processed via matlab CA. For example, I know that I can use caput to set the PV.PROC value to true using the command line, but due to the implementation of CA in matlab, this does not work (or at least I didn’t figure out a way to translate that method directly).

Regards Adam

PS – I’ve attached a matlab “app” which essentially is a class to make interfacing with the CA a bit easier.

Dr Adam S Wyatt Senior Ultrafast Laser Scientist

Central Laser Facility STFC Rutherford Appleton Laboratory Harwell Campus, Didcot, OX11 0QX, UK Tel: +44 (0)1235 778841

From: Simon Gregor Ebner [mailto:notifications@github.com] Sent: 13 September 2017 06:40 To: channelaccess/ca_matlab ca_matlab@noreply.github.com Cc: Wyatt, Adam (STFC,RAL,CLF) adam.wyatt@stfc.ac.uk; Author author@noreply.github.com Subject: Re: [channelaccess/ca_matlab] Error during execution (#12)

sorry I still did not get any hold on a windows 10 machine in our lab.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/channelaccess/ca_matlab/issues/12#issuecomment-329064539, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AdJZtn-QMXxiRp9_ioPX0W0vTSCCS9yfks5sh2q2gaJpZM4OniXc.