Zulu Platform x64 Keeps Directory and Files Locked - Unable to DELETE - OSError unlink() UNKNOWN

Ignition: 8.1.0
Platform: Vision
Operating System: Windows Server 2019 Standard

I’m using a Gateway script to move, create, delete, etc…basically restructure some files. With this process, I use a ‘Work’ directory as an intermediate location. At the completion of the restructure, the ‘Work’ directory and it’s contents are copied to another location. Finally, an attempt is made to delete the ‘Work’.

The ‘Work’ delete process works sometimes, but not others.

When the ‘Work’ delete does not function as expected, the Script Console throws the following:

Traceback (most recent call last):
File “”, line 16, in
File “module:SubGen.SCAN”, line 73, in dropOff
File “module:SubGen.FILE”, line 2270, in cleanDrop
File “C:\Users\phoenix.ignition\cache\gwlocalhost_8088\C0\pylib\shutil.py”, line 252, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File “C:\Users\phoenix.ignition\cache\gwlocalhost_8088\C0\pylib\shutil.py”, line 250, in rmtree
os.remove(fullname)
OSError: unlink(): an unknown error occurred: S:\Work\4524788259\CrossReference.pdf

If Manual deletion of this file (or the directory) is attempted the following Message Box appears:

“…The action can’t be completed because the file is open in Zulu Platform x64 Architecture…”
…and goes on to indicate the file / directory object

I’ve used SysInternals - Process Explorer to verify that is locked by the Zulu Platform x64.

This lock remains for several minutes (or several hours) and releases after a while on it’s own…at that time the files can be deleted. …or you can use Process Explorer to delete the PID that is attached to the object from the process (most of the time).

Questions:

  1. Anyone seen this?
  2. Is there a jython call that can be use to terminate the lock on the file, upon completion of operation?
  3. Are there other ways to release this condition?

Information:
Not attempting anything major…parsing an Excel file and copying pdf files based on the information in Excel.

Thanks for your time…

Use java.io and friends instead of the jython standard library.

1 Like

Ideally, probably, one of the static methods in java.nio.file.Files:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html