When running "Process start command" service in parallel to "FS copy" (on two different files) on the same remote machine I am getting the error RC 10 and RC OS 32 when trying to do some operation on the copied file (such as delete, Process start command)
I am running on windows and using the C++ dlls of STAF
STAF version 3.4.24.1
Can the STAF work in parallel like I need it? (when I try to run the same service (e.g. Process ,"FS" ) in parallel ,everything is working, only when i try to "Mix" services I encountered a problem.)
Do I need to "turn on" some flag when using the STAF in parallel on the same remote machine?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You get operating system error code 32 on Windows whenever your code tries to do things like writing to the same file simultaneously.
C:>net helpmsg 32
The process cannot access the file because it is being used by another process.
You can use the STAF Semaphore (SEM) service to prevent your code from writing to the same file simultaneously. The SEM service allows you to manipulate and manage mutex and event semaphores. A mutex semaphore allows you to synchronize access to a particular resource (such as a file). You could use the SEM service to REQUEST exclusive access of a mutex semaphore before submitting a request (e.g. FS COPY, FS DELETE, PROCESS START) that requires exclusive access to a file and then RELEASE exclusive access of the semaphore when done.
I am not accessing the same file.
I do "Copy" on file A
and doing "Run" (process start command) on file B simultaneously.
and I am getting the error when tring to Run/Delete file A while file B is runnig.
if I was doing it to the same file of course it isn't a staf bug but a sync bug
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
STAF works fine running multiple different service requests in parallel. It was designed to do this and this is done all the time.
Take a look at your particular STAF service requests that are running when you get this error and look at the error message(s). Does the error message provide any indication of the file/directory when you get an RC 10 with OS error code 32? Are you sure that you aren't trying to access the same file/directory simulataneously? For example, note that a PROCESS START request is accessing not only whatever command is being run, but that command itself could be accessing more files. Also, if you don't specify the WORKDIR option on your PROCESS START request, the command will be started from whatever directory STAFProc was started from. And are you using the STDOUT and/or STDERR options on your PROCESS START request? If so, note that STDOUT/STDERR specifies the name of the file to which standard output/error will be redirected. If the file already exists, it will be replaced. If the directory path specified for the file does not exist, it will be created. Are you fully-qualifying the name you specfiy for STDOUT/STDERR? Are you sure your FS service request that is being run simultaneously isn't trying to write to or delete a file/directory that a PROCESS START request is using because the operating system is returning error code 32 (The process cannot access the file because it is being used by another process).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for the detailed answer.
I am not using the STDOUT/STDERR options
I will check all the other issues you mantioned and I will get back with answers ASAP
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I checked all the things you mentioned and i didn't find any thing
I attached my test program that creates the error.
you will need to do the following:
1. change #define REMOTE_MACHINE_NAME1 <Put some="" Remote="" machine=""> -> to your own remote machine
2. copy the file "STAFDemoV2.bat" into the remote machine under "c:\"
3. create folder in the local and remote machine that calls "C:\TempGRAS"
Please first of course look at my code and see if i worked with STAF as i should
If yes -> please run the program and let me know why i am getting the error
did you have a chance to look at my problem?
we tried few other solutions (using STAF) but we still getting the same error of OS RC 32 and only when we use the STAF.
can you please look at it?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When running "Process start command" service in parallel to "FS copy" (on two different files) on the same remote machine I am getting the error RC 10 and RC OS 32 when trying to do some operation on the copied file (such as delete, Process start command)
I am running on windows and using the C++ dlls of STAF
STAF version 3.4.24.1
Can the STAF work in parallel like I need it? (when I try to run the same service (e.g. Process ,"FS" ) in parallel ,everything is working, only when i try to "Mix" services I encountered a problem.)
Do I need to "turn on" some flag when using the STAF in parallel on the same remote machine?
You get operating system error code 32 on Windows whenever your code tries to do things like writing to the same file simultaneously.
C:>net helpmsg 32
The process cannot access the file because it is being used by another process.
You can use the STAF Semaphore (SEM) service to prevent your code from writing to the same file simultaneously. The SEM service allows you to manipulate and manage mutex and event semaphores. A mutex semaphore allows you to synchronize access to a particular resource (such as a file). You could use the SEM service to REQUEST exclusive access of a mutex semaphore before submitting a request (e.g. FS COPY, FS DELETE, PROCESS START) that requires exclusive access to a file and then RELEASE exclusive access of the semaphore when done.
For more information on the SEM service, see section "8.16 Semaphore (SEM) Service" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRSEMSRV.
Last edit: Sharon Lucas 2016-01-25
Hi Sharon
I will try to explain my problem more accurately
I am not accessing the same file.
I do "Copy" on file A
and doing "Run" (process start command) on file B simultaneously.
and I am getting the error when tring to Run/Delete file A while file B is runnig.
if I was doing it to the same file of course it isn't a staf bug but a sync bug
Thanks
STAF works fine running multiple different service requests in parallel. It was designed to do this and this is done all the time.
Take a look at your particular STAF service requests that are running when you get this error and look at the error message(s). Does the error message provide any indication of the file/directory when you get an RC 10 with OS error code 32? Are you sure that you aren't trying to access the same file/directory simulataneously? For example, note that a PROCESS START request is accessing not only whatever command is being run, but that command itself could be accessing more files. Also, if you don't specify the WORKDIR option on your PROCESS START request, the command will be started from whatever directory STAFProc was started from. And are you using the STDOUT and/or STDERR options on your PROCESS START request? If so, note that STDOUT/STDERR specifies the name of the file to which standard output/error will be redirected. If the file already exists, it will be replaced. If the directory path specified for the file does not exist, it will be created. Are you fully-qualifying the name you specfiy for STDOUT/STDERR? Are you sure your FS service request that is being run simultaneously isn't trying to write to or delete a file/directory that a PROCESS START request is using because the operating system is returning error code 32 (The process cannot access the file because it is being used by another process).
Thank you for the detailed answer.
I am not using the STDOUT/STDERR options
I will check all the other issues you mantioned and I will get back with answers ASAP
Thanks
Hi Sharon
I checked all the things you mentioned and i didn't find any thing
I attached my test program that creates the error.
you will need to do the following:
1. change #define REMOTE_MACHINE_NAME1 <Put some="" Remote="" machine=""> -> to your own remote machine
2. copy the file "STAFDemoV2.bat" into the remote machine under "c:\"
3. create folder in the local and remote machine that calls "C:\TempGRAS"
Please first of course look at my code and see if i worked with STAF as i should
If yes -> please run the program and let me know why i am getting the error
thanks
HiSharon
Hi Sharon
did you have a chance to look at my problem?
we tried few other solutions (using STAF) but we still getting the same error of OS RC 32 and only when we use the STAF.
can you please look at it?
Thanks