Partial files encrypted (1 KB file size) when using PGP Encrypt action


THE INFORMATION IN THIS ARTICLE APPLIES TO:

  • EFT Server any

SYMPTOM

When using the PGP Encrypt action I see a partial file or a 1KB file at random times. Sometimes files are encrypted correctly, sometimes a 1KB file is shown.

Consider the following workflow.

1. Files are compress by Process A


2. A Process B (Folder monitor) PGP encrypts each ZIP file added into the archive directory .

In this scenario the issue is related to a race condition between the PGP action and the Compress that generates the zip file. The reason is random why this works sometime or under some situations, is when the PGP action is trying to read the file it fails to do so, since the ZIP action hasn't finished closing the file.

This is a workflow design problem, a folder monitors triggers order by the OS, sometimes it could be a small delay between trigger and the action. If Process A is able to compress and close the file before the Process B is trigger, the rule will work for example when small files are compress the rule works.

We also can confirm that there is an error in the EFT log file.

RESOLUTION

Most of the time that you see a partial file instead of its expected file size is due a wrong custom business logic, workflow design issue, poor error handling or network issues.

Unless the behavior occurs consistently (not random) for all of rules/actions that could indicate an application or environment issue.

In this case since it occurs randomly its related to a design issue. There are different ways to solve this issue and each one will depend on your business requirements.

Option 1. Use the PGP Action after each Compress action in the same event rule and use error handling in case that any of it fails.

Option 2. Use a Move (Rename) File Action to move the ZIP files into the folder monitor path. Since the Move (Rename) file operation is atomic or transactional this guarantee that the file will be move after the ZIP action completes and folder monitor won't trigger until the file was moved. Avoid rely on file added when you are depending on the non-transactional file operation like create, append, write, upload, download, compress, encrypt, scan, as the folder monitor will trigger before the file is ready to be processed.

 

Below are some links to our documentation on how EFT Folder Monitor rules are created to help you understand the rules and action behavior and its order of execution.

Folder Monitor Event
* Order in which Actions are Executed
* Order in which Event Rules are Executed

Finally, if you have purchased Expert Services contract and need assistance on refactoring or changing event rules or workflow design, please contact your expert advisor directly to assist you.