Skip to content

Glue streaming job throws FileDownloadException from S3 location

0

Hi,

We have an AWS Glue streaming job that runs 24x7 and consumes messages from MSK. Yesterday, the job started failing during batch processing with the following exception:

ERROR GlueLogger:  Batch processing failed with following error: An error occurred while calling o697195.collectToPython.
: org.apache.spark.SparkException: Exception thrown in awaitResult:

From the error trace, we found these messages:

Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 48410.0 failed 4 times, most recent failure: Lost task 3.3 in stage 48410.0 (TID 1234011) (<ip address> executor 6): org.apache.spark.sql.execution.datasources.FileDownloadException: Failed to download file path: s3://<bucket name>/<glue-catalog-table-name>/year=2025/month=10/day=27/run-20251027075433-152-part-block-0-0-r-00071-snappy.parquet, range: 0-7710, partition values: [2025,10,27], isDataPresent: false, eTag: 93f71620048f6489

The referenced S3 file exists and is accessible without issues. We also refreshed the related Glue catalog table to rule out stale data, but it didn’t help. Restarting the job resolved the issue.

Could you please help us understand the potential root cause of this error and suggest any recommended remediation steps to handle or prevent it in the future?

asked 10 months ago272 views

1 Answer
0

This error indicates that your AWS Glue streaming job encountered an issue downloading a Parquet file from Amazon S3 during batch processing. Based on the error message, there are several potential causes for this FileDownloadException:

  1. Temporary S3 Access Issues: Even though the file exists and is normally accessible, there might have been temporary permission issues or S3 service disruptions at the time of the job execution.

  2. IAM Role Permissions: The IAM role used by your Glue job might have insufficient permissions to access the specific S3 bucket or objects. This could be due to:

  • Bucket policies restricting access
  • IAM policies that need updating
  • S3 ACL settings
  • S3 Block Public Access settings
  • S3 object lock settings
  • VPC endpoint policies
  • AWS organization policies
  • Access point settings
  1. Network Connectivity Issues: If your Glue job runs within a VPC, there might have been temporary network connectivity issues between the Glue job and S3.

  2. S3 Request Rate Limitations: Your job might have hit S3 request rate limits, especially if it's processing a large number of files simultaneously.

Recommended remediation steps:

  1. Review IAM Permissions: Ensure the IAM role used by your Glue job has the necessary S3 permissions, particularly s3:GetObject for the bucket and objects being accessed.

  2. Implement Retry Logic: Modify your Glue job to include robust retry mechanisms for S3 operations to handle transient failures.

  3. Monitor with CloudWatch: Set up CloudWatch monitoring for your Glue streaming job to track metrics and detect issues early. Check logs for error messages, warnings, or unusual patterns.

  4. Test Locally: Before deploying updates to your streaming job, test them locally using AWS Glue Docker images or the AWS Glue ETL library.

  5. Optimize S3 Access Patterns: If your job accesses many small files, consider optimizing your S3 access patterns to reduce the number of API calls.

  6. Consider Checkpointing: Implement proper checkpointing in your streaming job to ensure it can recover from failures without reprocessing all data.

Since restarting the job resolved the issue, it was likely a transient problem. However, implementing the above recommendations should help make your job more resilient to similar issues in the future.
Sources
Troubleshoot Amazon S3 errors from AWS SDK exceptions | AWS re:Post
Troubleshoot AWS Glue streaming job | AWS re:Post
5.2 - Spark troubleshooting and performance tuning | AWS Open Data Analytics

answered 10 months ago

EXPERT

reviewed 10 months ago

  • How can we figure out that there was a S3 temporary access / Network connectivity issue at time of job execution ?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.