turcsanyip commented on code in PR #7051: URL: https://github.com/apache/nifi/pull/7051#discussion_r1146356125
########## nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java: ########## @@ -503,11 +503,21 @@ private synchronized void ageoffLocalState(long ageCutoff) { @Override public void onTrigger(final ProcessContext context, final ProcessSession session) { + FlowFile flowFile = session.get(); if (flowFile == null) { return; } + try { + setClientAndRegion(context, flowFile.getAttributes()); + } catch (Exception e) { + getLogger().error("Failed to initialize S3 client", e); + flowFile = session.penalize(flowFile); + session.transfer(flowFile, REL_FAILURE); + return; Review Comment: @krisztina-zsihovszki Multiple threads can execute `onTrigger()` in parallel so it is not safe to create and store the client in the `client` field of the processor (`setClientAndRegion()` is doing that). I suggest implementing client caching similar to [NIFI-10152](https://issues.apache.org/jira/browse/NIFI-10152) for Azure ADLS processors. It would also eliminate the recreation of the client in every onTrigger if the client can be reused (same region). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org