Exam DVA-C01 All QuestionsBrowse all questions from this 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?

    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
AulaitQMOption: B

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

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

Please note multiple invocation occurs for every file.

dimon_millioner

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.

kaesOption: C

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

MalayShahOption: C

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

MMaquisOption: B

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

itsonlyjit1990

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.

ninomfr64Option: B

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

SyreOption: C

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

captainpike

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.

sebasbonillaOption: C

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.

sweetheatmn

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

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

Rpod

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

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.

ics_911Option: C

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."

dimon_millionerOption: D

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.

rcaliandroOption: B

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

KDennisssOption: C

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.

clarksuOption: B

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.

tonychoucc

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, ..."

may2021_r

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.