<-- Back

How to address S3ObjectInputStream warnings in Mendix applications

Introduction

When interacting with S3 storage services, the following warning appears:

WARNING: Not all bytes were read from the S3ObjectInputStream, aborting HTTP connection. This is likely an error and may result in sub-optimal behavior. Request only the bytes you need via a ranged GET or drain the input stream after use.

This article will explain how to address this warning.

Environment

  • Applications hosted in any deployment type

Instructions/Procedure

This warning indicates that a file was closed by the application before it was completely consumed. This can result in sub-optimal behavior. Follow these steps to address the issue:

  1. Identify the source of the warning. Check if the application uses web services or any actions that could result in files being closed prematurely. 
  2. Determine the correct handling method

    There are two ways to handle this:

    • Option 1: Read the rest of the data from the input stream so the connection can be reused.
    • Option 2: Call s3ObjectInputStream.abort() to close the connection without reading the data. Note that this approach may result in a performance hit when the connection is re-created for the next request.
  3. Review the application logic. Verify that the application is not closing files prematurely during operations like published web services. This is often the primary cause of such warnings.
  4. Consult external resources for more information

Outcome

After implementing the appropriate method (reading the data or calling abort()), the warning should no longer appear.

Internal information related

  • 226349 

Additional information 

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.