epics-base / pvaClientCPP

pvaClientCPP is an EPICS V4 C++ module
http://epics-pvdata.sourceforge.net/index.html
Other
2 stars 8 forks source link

repeated put followed by get can fail #70

Open mrkraimer opened 3 years ago

mrkraimer commented 3 years ago

If a client does a put to multiple channels followed by a get to that same channels the gets do not always get the same value that was put.

The problem occurs with with both pvaClient and pvaClientMultiChannel. Sinisa reported the problem for pvaClientMultiChannel.

Two tests were added to exampleClient/testClient: testNTMultiPutGet and testPutGet. These demonstrate the problem. If they are run against a single channel both report no errors. As soon as more than one channel is specified both report errors.

mrkraimer commented 3 years ago

I still do not have a solution to this problem but I think it is caused by race conditions related to how event.h is being used. I have pushed changes to branch pvaClientMultiChannel_changes. I did this so that I will not lose changes I know should be made before I pursue this further.

I also made changes to exampleClient. There are now tests in exampleClient/testMultiplePutGet. It tests that replace what was in exampleClient/testClient: testNTMultiPutGet and testPutGet.. Note that the only test that looks like to works every time is exampleClient/testMultiplePutGet/pvaPutGet This test does not use pvaClient. It only uses pvAccess. BUT it also does not use event.h. It sleeps until requests complete. Thus NOT a good solution.

mrkraimer commented 3 years ago

In exampleClient/testMultiplePutGet, I renamed pvaPutGet to pvaPutGetSleep. I then added pvaPutGetMutex. I pushed the changes.

Both look they work successfully every time. So now I think I now have a good way to tackle the problems in pvaClientCPP.

But I may not get a chance to work on it until day after tomorrow.

mrkraimer commented 3 years ago

I made quite a few changes. See latest commit on branch pvaClientMultiChannel_changes. Note that exampleCPP has also been updated. Now all tests in exampleCPP/testMultiplePutGet work successfully. I am now going to do more testing on connection management and then work on release notes and documentation.

As far as I know I have not broken any existing client code unless the client called methods that are now protected.

anjohnson commented 3 years ago

Hi Marty, the exampleCPP builds on Jenkins have been failing for several days. I haven't checked the logs in detail, but this error appears on the RHEL6 and RHEL7 builds:

../multiPutDouble.cpp: In function 'int main(int, char**)':
../multiPutDouble.cpp:140: error: 'stod' is not a member of 'std'

I think your updates may have assumed a newer version of the C++ compiler than we have on those targets. The API is different but the epicsStdlib.h header defines a couple of routines that might work instead, or maybe strtod()?

I just stopped using make -j4 for the Windows builds to make it easier to find the error and they both fail with this:

c:\jenkins\win64-2\workspace\3.15-example-win64\testmultipleputget\src\pvaputgetsleep.cpp(13): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

Base provides an osiUnistd.h header which is designed to replace unistd.h and is available on all our targets, please try that instead.

mrkraimer commented 3 years ago

On 2/26/21 7:15 PM, Andrew Johnson wrote:

Hi Marty, the exampleCPP builds on Jenkins have been failing for several days. I haven't checked the logs in detail, but this error appears on the RHEL6 and RHEL7 builds:

|../multiPutDouble.cpp: In function 'int main(int, char**)': ../multiPutDouble.cpp:140: error: 'stod' is not a member of 'std' |

I think your updates may have assumed a newer version of the C++ compiler than we have on those targets. The API is different but the epicsStdlib.h header defines a couple of routines that might work instead, or maybe |strtod()|?

I just stopped using |make -j4| for the Windows builds to make it easier to find the error and they both fail with this:

|c:\jenkins\win64-2\workspace\3.15-example-win64\testmultipleputget\src\pvaputgetsleep.cpp(13): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory |

Base provides an osiUnistd.h header which is designed to replace unistd.h and is available on all our targets, please try that instead.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/epics-base/pvaClientCPP/issues/70#issuecomment-786961550, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOVBVWGKA6EYRRO4DZ2PFDTBA2TPANCNFSM4X4Q324A.

I replaced stod with strtod. I did not see osiUnistd.h in epics-base/include

mrk> pwd /home/epics7/epics-base/include mrk> ls osi* osiClockTime.h  osiPoolStatus.h  osiProcess.h  osiSock.h osiWireFormat.h mrk>

anjohnson commented 3 years ago

osiUnistd.h gets installed into the include/os/<os-class> directory which is also in the compiler's include path. This allows a single Base installation to be shared by multiple OSs where the file's contents have to be different:

woz$ ls include/os/Darwin/
epicsAtomicOSD.h    osdInterrupt.h      osdThread.h
epicsGetopt.h       osdMessageQueue.h   osdTime.h
epicsMMIO.h     osdMutex.h      osdVME.h
epicsMMIODef.h      osdPoolStatus.h     osdWireConfig.h
epicsMath.h     osdSock.h       osdWireFormat.h
osdEvent.h      osdStrtod.h     osiUnistd.h
mrkraimer commented 3 years ago

I just pushed changes to branch pvaClientMultiChannel_changes. I think I am getting near ready to merge.

Andrew, The test related code made exampleCPP harder to understand. I moved the test related code from exampleCPP to https://github.com/mrkraimer/testClientCPP

This had a side effect of getting rid of the exampleCPP builds on Jenkins failing.