Flink Kafka to BucketingSink to S3 - S3Exception

Posted by Flink Developer on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Flink-Kafka-to-BucketingSink-to-S3-S3Exception-tp24151.html

Hi, I'm running a scala flink app in an AWS EMR cluster (emr 5.17, hadoop 2.8.4)  with flink parallelization set to 400. The source is a Kafka topic and sinks to S3 in the format of: s3://<day>/<hour>/<worker_number>/<files>. There's potentially 400 files writing simultaneously.

Configuration:
- Flink v1.5.2
- Checkpointing enabled w/ RocksDb (flink-statebackend-rocksdb_2.11, v1.6.1). Interval is every 2 mins with max concurrent set to 1. Min pause between checkpoints in 2 mins. Timeout is set to 2 mins.
- BucketingSink (flink-connector-filesystem_2.11, v1.6.1). 
- Batch file size is set to 5mb. 
- Batch rollover interval is set to 30min
- Writer uses GZip compression
- Hadoop Maven Dependencies (hadoop-hdfs v3.1.1, hadoop-common v3.1.1, hadoop-core v1.2.1, hadoop-aws v3.1.1)

The app is able to run for hours straight, but occasionally (once or twice a day), it displays the following exception. When this happens, the app is able to recover from previous checkpoint, but I am concerned about the exception:

Caused by: java.io.IOException: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception: Not Found (Service: Amazon S3; Status Code 404; Error ... Request ID: xxxxxxxx, S3 Extended Request ID: xxxxxxxxxxxxxxxxxxxxxxxxxx
Caused by: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception: Not Found (Service: Amazon S3; Status Code 404; Error ... Request ID: xxxxxxxx, S3 Extended Request ID: xxxxxxxxxxxxxxxxxxxxxxxxxx

And sometimes, it will show this:

What causes this and how can it be resolved? Thank you.

There seems to be a related Flink ticket and PR here, but I'm not sure if this is the exact same issue and if it has been resolved:
https://issues.apache.org/jira/browse/FLINK-6306
https://github.com/apache/flink/pull/3752
https://github.com/apache/flink/pull/4607