DVA-C01 Exam QuestionsBrowse all questions from this exam

DVA-C01 Exam - Question 65


A company has an application that writes files to an Amazon S3 bucket. Whenever there is a new file, an S3 notification event invokes an AWS Lambda function to process the file. The Lambda function code works as expected. However, when a developer checks the Lambda function logs, the developer finds that multiple invocations occur for every file.

What is causing the duplicate entries?

Show Answer
Correct Answer: C

Amazon S3 is delivering the same event multiple times. S3 event notifications are designed to be delivered at least once, meaning that in some cases the same event might be sent more than once to ensure delivery. This can lead to multiple invocations of a Lambda function for the same file event, resulting in duplicate log entries.

Discussion

17 comments
Sign in to comment
AulaitQMOption: B
Sep 27, 2022

I vote B, although I agree that the question clearly states that the code works correctly. It cannot be A, because if the files are being written to the wrong bucket then the lambda wouldn't trigger even once. C assumes an underlying issue with AWS, which although it could happen, it is unlikely. D makes no sense.

tbhtp
Oct 12, 2022

altough indeed the at least once suggest S3 is possibly triggering multiple times for one event (which supports C) the following troubleshooting is only pointing to the retries (supports B): https://aws.amazon.com/premiumsupport/knowledge-center/lambda-function-duplicate-invocations/

raaja090
Aug 25, 2023

Please note multiple invocation occurs for every file.

dimon_millioner
Sep 30, 2023

D. Application works intermittently, therefore Lambda will invoke every time app start after it was stopped. Logs were split into multiple smaller files, each file would contain different log entries rather than duplicate entries, because for each new App start each time will new log file.

MalayShahOption: C
Jul 8, 2023

As per the aws documentation, it is specified that S3 event notification are designed to deliver atleast once which means it can deliver more than once: Aws Ref: https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html StackOverflow: https://stackoverflow.com/questions/56772299/s3-notification-creates-multiple-events

kaesOption: C
Sep 24, 2023

https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html "Amazon S3 event notifications are designed to be delivered at least once."

MMaquisOption: B
Feb 16, 2023

The Lambda error handler is not implemented properly and the function retries the execution. You should not rely on ChatGPT's answer.

sweetheatmn
Feb 22, 2023

Why most answers go with B despite that the question clearly states that "The Lambda function code works as expected" I go with C, here is what ChatGPT thinks When an S3 bucket has a large number of objects, S3 may send multiple S3 event notifications for the same object, especially when the object is uploaded or modified quickly. This is because S3 is designed to provide high durability and availability, and it ensures that all event notifications are delivered. However, this can lead to duplicate event notifications being received by the Lambda function.

Groot2
Feb 24, 2023

ask you AI friend for reference, If I were you I would not believe it without one

Rpod
May 4, 2023

Hmmm did chatGpt learn something new ? This is is what it says today - The most likely cause of the duplicate invocations is that the Lambda function did not run correctly, and AWS Lambda is automatically retrying the invocation. When a Lambda function returns an error, Lambda automatically retries the invocation twice, with delays between retries. If the function continues to return an error, the invocation is not retried further. The developer can check the Lambda function's error handling and logging to diagnose and resolve the issue. Additionally, the developer can configure the function's concurrency limit to avoid invoking the function multiple times concurrently, and use a dead-letter queue to capture events that are not processed successfully.

sweetheatmn
Oct 4, 2023

I'm revisiting the question preparing for the exam and think my original reply is just dumb. Do not depend on ChatGPT, it sometimes gives made-up wrong replies.

sebasbonillaOption: C
Feb 27, 2023

Option C is the correct answer for this scenario. The duplicate entries are being caused by Amazon S3 delivering the same S3 notification event multiple times. S3 notification events are not guaranteed to be delivered only once, and it is possible for events to be duplicated or delivered out of order. This can occur due to network issues, processing delays, or other factors.

captainpike
Mar 16, 2023

C. - Lamda has to be idempotent (likely the question is trying to get to this point) https://aws.amazon.com/premiumsupport/knowledge-center/lambda-function-duplicate-invocations/ suggests Lamba should handle duplicated invocation; https://aws.amazon.com/premiumsupport/knowledge-center/lambda-function-idempotent/ Not B: It does not matter if the code works or does not work correctly. The invocation of lambda would always happens no matter how good or bad the lambda code is. That implies that something is invoking lambda multiple times.

SyreOption: C
Apr 12, 2023

The answer here has to be C guys, it’s the most probable one.

ninomfr64Option: B
Aug 24, 2023

For me B is correct. C cannot be as if we have same event delivered multiple times we will a different lambda execution (ID) for each events. Different executions goes into different CloudWatch log streams, while retries hold the same execution ID and goes in the same CW log streams

itsonlyjit1990
Jul 2, 2024

Answer is C. Now a days so much trust issue is present that instead of confirming that the lambda function works as expected people still don't believe this and still think the option B.

may2021_r
Feb 14, 2023

For me Correct Answer is C. Amazon S3 is delivering the same event multiple times. The duplicate entries are most likely being caused by Amazon S3 delivering the same S3 notification event multiple times. This can happen if the S3 bucket has multiple event notifications configured, or if there is a delay in the delivery of the event notification, causing S3 to retry the notification.

tonychoucc
Feb 15, 2023

I asked the ChatGPT, it says the answer is posibily more like C I think the key point is that the question tells us : "The Lambda function code works as expected, ..." but answer B shows "The Lambda function did not run correctly, ..."

clarksuOption: B
Feb 26, 2023

There is NO conflict between 'Multi invocations for EVERY FILE' & ' The Lambda function code works as expected'. ' Works as expected' does not imply that NO error caught and being backfilled. It could be = the Lambda code works but it requires multiple times of execution to finish a file(every file). It rings a bell on ASYNC processing , thus I choose B.

KDennisssOption: C
Mar 27, 2023

Option A is less likely because if the bucket name was incorrectly specified, the Lambda function would not be invoked at all. Option B is also less likely because if the Lambda function did not run correctly, it would not be invoked at all, and there would be no logs generated. Option D is not likely because if the logs were split into multiple smaller files, each file would contain different log entries rather than duplicate entries.

rcaliandroOption: B
Jun 28, 2023

B is for sure the correct answer. If a call to a lambda function fails the function will be executed other two times with a delay (that's why we can find 2 or 3 logs with the same ID). Furthermore, if the function throttles three times then it is possible to configure a DLQ to debug and see what's happen for that specific event

dimon_millionerOption: D
Sep 30, 2023

D. Application works intermittently, therefore Lambda will invoke every time app start after it was stopped. Logs were split into multiple smaller files, each file would contain different log entries, because for each new App start each time will new log file.

ics_911Option: C
Jul 18, 2024

If the lambda function did not run correctly and lambda retried the invocation as option B stated, this would typically be reflected in the function's error log or metrics. The question states that "the function code works as expected."