Application issues
This section contains solutions for error conditions that you may encounter with your Managed Service for Apache Flink application.
Topics
Application is stuck in a transient status
If your application stays in a transient status (STARTING,
UPDATING, STOPPING, or AUTOSCALING), you
can stop your application by using the StopApplication action with the Force
parameter set to true. You can't force stop an application in the
DELETING status. Alternatively, if the application is in the
UPDATING or AUTOSCALING status, you can roll it back
to the previous running version. When you roll back an application, it loads state
data from the last successful snapshot. If the application has no snapshots, Managed Service for Apache Flink
rejects the rollback request. For more information about rolling back an
application, see RollbackApplication action.
In enhanced snapshot mode, a rollback from the UPDATING or
AUTOSCALING status restores the newest READY enhanced
snapshot of the application. If the application has no READY
enhanced snapshot, the rollback fails with InvalidRequestException.
For more information, see Roll back an application.
Force-stopping your application may lead to data loss or duplication. To prevent data loss or duplicate processing of data during application restarts, we recommend you to take frequent snapshots of your application.
Upgrade to enhanced snapshot mode: To upgrade a running application,
you send an UpdateApplication request with SnapshotModeUpdate set to
ENHANCED_SNAPSHOTS. The request must also include SnapshotsEnabledUpdate,
even when you change only the mode. The application status is UPDATING until the upgrade completes.
To track the upgrade, call DescribeApplicationOperation
with the OperationId from the response. For an application in the READY status,
the upgrade takes effect at once. The status stays READY. The response has no OperationId.
For more information, see
Upgrade an existing application to enhanced snapshots.
Causes for stuck applications include the following:
-
Application state is too large: Having an application state that is too large or too persistent can cause the application to become stuck during a checkpoint or snapshot operation. Check your application's
lastCheckpointDurationandlastCheckpointSizemetrics for steadily increasing values or abnormally high values. -
Application code is too large: Verify that your application JAR file is smaller than 512 MB. JAR files larger than 512 MB are not supported.
-
Application snapshot creation fails: Managed Service for Apache Flink takes a system snapshot of the application during an
UpdateApplicationorStopApplicationrequest. A system snapshot is a snapshot that Managed Service for Apache Flink creates for you. In enhanced snapshot mode, each system snapshot is an enhanced snapshot. With application snapshots (legacy), each system snapshot is an application snapshot (legacy). The service then uses this system snapshot and restores the application using the updated application configuration to provide exactly-once processing semantics. In enhanced snapshot mode, Managed Service for Apache Flink also takes a system snapshot when you add or delete a Amazon VPC configuration or a CloudWatch logging option. For more information, see System snapshots. If automatic snapshot creation fails, see Snapshot creation fails following. -
Restoring from a snapshot fails: If you remove or change an operator in an application update and attempt to restore from a snapshot, the restore will fail by default if the snapshot contains state data for the missing operator. In addition, the application will be stuck in either the
STARTINGorUPDATINGstatus. To change this behavior and allow the restore to succeed, change theAllowNonRestoredStateparameter of the application'sFlinkRunConfigurationtotrue. With this setting, the restore skips state data that Apache Flink cannot map to the new program. -
Application initialization taking longer: Managed Service for Apache Flink uses an internal timeout of 5 minutes (soft setting) while waiting for a Flink job to start. If your job is failing to start within this timeout, you will see a CloudWatch log as follows:
Flink job did not start within a total timeout of 5 minutes for application: %s under account: %sIf you encounter the above error, it means that your operations defined under Flink job’s
mainmethod are taking more than 5 minutes, causing the Flink job creation to time out on the Managed Service for Apache Flink end. We suggest you check the Flink JobManager logs as well as your application code to see if this delay in themainmethod is expected. If not, you need to take steps to address the issue so it completes in under 5 minutes.
You can check your application status using either the ListApplications or the DescribeApplication actions.
Snapshot creation fails
The Managed Service for Apache Flink service can't take a snapshot under the following circumstances:
The application reached its snapshot quota. For more information, see Manage application backups using snapshots.
The application doesn't have permissions to access its source or sink.
The application code isn't functioning properly.
The application is experiencing other configuration issues.
If you get an exception while taking a snapshot during an application update or while
stopping the application, set the SnapshotsEnabled
property of your application's ApplicationSnapshotConfiguration to false and
retry the request.
Snapshots can fail if your application's operators are not properly provisioned. For information about tuning operator performance, see Operator scaling.
After the application returns to a healthy state, we recommend that you
set the application's SnapshotsEnabled property to true.
Enhanced snapshots: A CreateSnapshot
call returns before Managed Service for Apache Flink captures the state. If the capture fails later, the enhanced snapshot status changes to FAILED.
To find the cause, call DescribeSnapshotOperation
with the snapshot name and the SnapshotOperationId from the CreateSnapshot response.
Then read SnapshotOperationFailureDetails.ErrorInfo.ErrorCode. The following table lists the values.
ErrorCode | Cause and fix |
|---|---|
ApplicationStateCaptureFailed | The Apache Flink job did not complete the savepoint. If logging is enabled, check the CloudWatch logs of the application. Then retry the request. |
ApplicationStateCaptureTimedOut | The savepoint timed out. If logging is enabled, check the CloudWatch logs of the application for slow or blocked operators. Then retry the request. |
KMSAccessDenied | The key policy of the application key does not allow Managed Service for Apache Flink to use the key. Update the key policy, then retry the request. |
If the operation status is CANCELLED, the response has no ErrorCode.
Retry the request after the application is RUNNING and no other application operation is in progress.
For more information, see Failure reasons.
For the exceptions that CreateSnapshot returns, see Troubleshoot snapshot API errors.
Cannot access resources in a VPC
If your application uses a VPC running on Amazon VPC, do the following to verify that your application has access to its resources:
-
Check your CloudWatch logs for the following error. This error indicates that your application cannot access resources in your VPC:
org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.If you see this error, verify that your route tables are set up correctly, and that your connectors have the correct connection settings.
For information about setting up and analyzing CloudWatch logs, see Logging and monitoring in Amazon Managed Service for Apache Flink.
Data is lost when writing to an Amazon S3 bucket
Some data loss might occur when writing output to an Amazon S3 bucket using Apache Flink version 1.6.2. We recommend using the latest supported version of Apache Flink when using Amazon S3 for output directly. To write to an Amazon S3 bucket using Apache Flink 1.6.2, we recommend using Firehose. For more information about using Firehose with Managed Service for Apache Flink, see Firehose sink.
Application is in the RUNNING status but isn't processing data
You can check your application status by using either the ListApplications or the DescribeApplication actions. If your application enters the RUNNING status but isn't writing data to your sink, you can troubleshoot the issue by adding an Amazon CloudWatch log stream to your application. For more information, see Work with application CloudWatch logging options. The log stream contains messages that you can use to troubleshoot application issues.
Snapshot, application update, or application stop error: InvalidApplicationConfigurationException
An error similar to the following might occur during a snapshot operation, or during an operation that creates a snapshot, such as updating or stopping an application:
An error occurred (InvalidApplicationConfigurationException) when calling the UpdateApplication operation: Failed to take snapshot for the application xxxx at this moment. The application is currently experiencing downtime. Please check the application's CloudWatch metrics or CloudWatch logs for any possible errors and retry the request. You can also retry the request after disabling the snapshots in the Managed Service for Apache Flink console or by updating the ApplicationSnapshotConfiguration through the AWS SDK
This error occurs when the application is unable to create a snapshot.
If you encounter this error during a snapshot operation or an operation that creates a snapshot, do the following:
-
Disable snapshots for your application. You can do this either in the Managed Service for Apache Flink console, or by using the
SnapshotsEnabledUpdateparameter of the UpdateApplication action. -
Investigate why snapshots cannot be created. For more information, see Application is stuck in a transient status.
-
Reenable snapshots when the application returns to a healthy state.
Enhanced snapshot mode: Managed Service for Apache Flink also returns InvalidApplicationConfigurationException
when a request uses a snapshot type that does not match the SnapshotMode value of the application.
The following table lists these causes.
| Cause | Fix |
|---|---|
A request to upgrade to enhanced snapshot mode restores from an application snapshot (legacy) by SnapshotName. |
Remove the restore configuration from the request. |
The application uses enhanced snapshot mode, and a restore request sets SnapshotName. |
Set SnapshotArn to the ARN of an enhanced snapshot. |
The application does not use enhanced snapshot mode, and a restore request sets SnapshotArn. |
Upgrade the application to enhanced snapshot mode, or use SnapshotName with an application snapshot (legacy). |
The application uses enhanced snapshot mode, and the request calls CreateApplicationSnapshot. |
Call CreateSnapshot instead. |
For more information, see Errors during the upgrade and Troubleshoot restore errors.
Upgrade to enhanced snapshot mode fails
An upgrade request can fail in two ways. Managed Service for Apache Flink can reject the request, or the upgrade operation can fail after Managed Service for Apache Flink accepts the request.
Rejected request: The application does not change. The following table lists the common causes.
| Exception | Cause | Fix |
|---|---|---|
InvalidArgumentException |
The application uses Apache Flink 1.19 or earlier, or a runtime other than Apache Flink. | Upgrade the application to Apache Flink 1.20 or later in a separate request. Then upgrade to enhanced snapshot mode. |
InvalidArgumentException |
The request includes a restore configuration, and the application is not RUNNING. |
Remove the restore configuration. |
InvalidArgumentException |
The request sets SnapshotModeUpdate to APPLICATION_SNAPSHOTS_LEGACY for an application in enhanced snapshot mode. |
You cannot reverse the upgrade with UpdateApplication. To return to application snapshots (legacy), roll back to the application version before the upgrade. For more information, see Roll back after the upgrade. |
AccessDeniedException |
The caller lacks a required permission, such as kinesisanalytics:CreateSystemSnapshot. |
Grant the caller the permission on the application ARN. |
ConcurrentModificationException |
CurrentApplicationVersionId or ConditionalToken does not match the current application. |
Call DescribeApplication, and then send the request with the current version ID. |
UnsupportedOperationException |
Enhanced snapshots are not available for your account in the Region of the request. | Contact AWS Support. |
Failed upgrade operation: The operation status is FAILED.
The result depends on the system rollback setting of the application:
System rollbacks turned on: Managed Service for Apache Flink returns the application to the
RUNNINGstatus on the version before the upgrade. The application no longer uses enhanced snapshot mode.System rollbacks turned off: The application stays in the
READYstatus.SnapshotModestaysENHANCED_SNAPSHOTS. To keep the state, callRollbackApplicationto return to the version before the upgrade.
After a failed upgrade with system rollbacks turned off, do not start the application with RESTORE_FROM_LATEST_SNAPSHOT.
The application has no enhanced snapshot, so the application starts without state.
For more information, see Errors during the upgrade and Roll back after the upgrade.
Restore from an enhanced snapshot fails
A StartApplication, UpdateApplication, or RollbackApplication request
that restores from an enhanced snapshot can return the errors in the following table.
| Exception | Cause | Fix |
|---|---|---|
ResourceInUseException |
The enhanced snapshot is not in the READY status. |
Wait until the enhanced snapshot is READY, or choose a different enhanced snapshot. |
ResourceNotFoundException |
No enhanced snapshot with this ARN exists in the account and Region. | Check the ARN with ListSnapshots. |
InvalidArgumentException |
With RESTORE_FROM_CUSTOM_SNAPSHOT, the request sets both SnapshotName and SnapshotArn, or neither. |
Set exactly one of the two members. |
InvalidArgumentException |
An UpdateApplication request has a restore configuration, and the application is not RUNNING. |
Use StartApplication with the restore configuration. |
AccessDeniedException |
The caller lacks a required permission. The missing permission can be one of the following:
kinesisanalytics:RestoreFromSnapshot on the enhanced snapshot,
kinesisanalytics:CreateSystemSnapshot on the application,
or kms:Decrypt on the AWS KMS key of the enhanced snapshot. |
Grant the caller the missing permission. |
InvalidRequestException |
RollbackApplication found no enhanced snapshot that meets the selection rule. For more information, see Roll back an application. |
Restore from a specific enhanced snapshot with RESTORE_FROM_CUSTOM_SNAPSHOT. |
A restore can also fail if the Apache Flink operator IDs (UIDs) of the application do not match the enhanced snapshot. For more information, see Restore to a different application.
For the full list of errors, see Troubleshoot restore errors.
Import or export of an enhanced snapshot fails
An ImportSnapshot or
ExportSnapshot request can fail in two ways:
Rejected request: The call returns an exception. For the exceptions and their fixes, see Troubleshoot import and export errors.
Failed operation: The snapshot operation status changes to
FAILED. CallDescribeSnapshotOperation, and readSnapshotOperationFailureDetails.ErrorInfo.ErrorCode. For eachErrorCodevalue and its fix, see Failure reasons.
A failed import leaves the enhanced snapshot in the FAILED status. To import again with the same name, first delete the failed enhanced snapshot.
A failed export leaves the enhanced snapshot in the READY status. You can call ExportSnapshot again.
Import fails with a checksum error
An import operation fails with the MissingObjectChecksum error code if a source object has no full-object checksum.
Every source object needs an Amazon S3 full-object checksum that uses the CRC64NVME algorithm.
To fix the error, upload each source object again with a full-object CRC64NVME checksum.
Then delete the failed enhanced snapshot, and import again.
Files that ExportSnapshot writes already have this checksum.
For more information, see Import an enhanced snapshot from Amazon S3.
DeleteSnapshot fails
DeleteSnapshot returns
ResourceInUseException when the enhanced snapshot is not in the READY or FAILED status.
For example, an imported enhanced snapshot is CREATING until the import completes.
Wait until the enhanced snapshot is READY or FAILED, and then send the request again.
If an operation such as an export uses the enhanced snapshot, Managed Service for Apache Flink accepts the delete and waits for that operation to finish.
Managed Service for Apache Flink does not protect an enhanced snapshot that an application uses. A running application does not block the delete. A restore configuration that names the enhanced snapshot also does not block the delete. After the delete, a later restore or rollback cannot use the enhanced snapshot.
For more information, see Delete a snapshot while an operation uses it.
java.nio.file.NoSuchFileException: /usr/local/openjdk-8/lib/security/cacerts
The location of the SSL truststore was updated in a previous deployment. Use the following value for the ssl.truststore.location parameter instead:
/usr/lib/jvm/java-11-amazon-corretto/lib/security/cacerts