D_pxGetFile is not allowing to delete the file from repository when in Stream mode

I have a requirement to move a file from one folder to another in a NAS repository

I have utilized D_pxGetFile to get the contents of the file and copy it to D_pxNewFile and save the D Page and delete the source file using D_pxDelete.

This is working fine when i keep responseType paramvalue as STRING in D_pxGetFile, for larger files i have to set this responseType paramvalue as STREAM, the file is producing, getting copied to target location, step with D_pxDelete is executing without errors, but if i check in the repository location the source file is still there, when i try to open it i am getting a message saying “You do not have permission to open this file, See the owner of the file or an administrator to obtain this permission”.

I tried Java step to delete the file instead D_pxDelete, executed without errors, but file is still there.
Tried deleting the file manually, file is disappearing but on refresh it comes back.

only when we restart the Pega Application, the files are getting deleted completely.

so i decided to stop using D_pxGetFile and went with a Java step for moving the file.

Any idea why D_pxGetFile is behaving this way for Stream mode, i also tried Page remove on D_pxGetFile before calling D_pxDelete, but it was doing the same.

Using D_pxGetFile in STREAM mode leaves an unclosed InputStream that maintains an active lock on the NAS file. This lock prevents the subsequent delete step from succeeding until the Pega node is restarted and the handle is released.

1 Like

Is there a way to release this lock, just for reading a file you acquire a lock on it and never letting it go till you restart the application doesn’t seem to be a good design.

You will be able to fix the issue when you enabled the drwx permissions of the path from Openshift / Kubernetes side in the cluster if your application hosted in On-prem containers.

Otherwise, You will need to handle the permissions of Pegauser of environment which ever your application is hosted in. We had the similar case but issue with Pega Deployment Manager. Issue fixed by adding the the permissions from openshift env. for us.