Skip to content

Timeout in FileAdapter or Empty response from server when trying to upload a small size file #3830

@cjosepha

Description

@cjosepha

Issue Description

I try to save a 19MB file via the rest api with Curl. Sometimes Curl indicates that the server response is empty, and sometimes the server respond with code 130 "Could not store file." This behavior is totally unpredictable and seems due to a timeout error in the FileAdapter.
I tried with both the S3Adapter and the default GridStoreAdapter and they produce the same behavior that I've just mentioned.

When response is {"code":130,"error":"Could not store file."} the server logs indicates a timeout in the FileAdapter:

  • connection 6 to ... timed out for the GridStoreAdapter
  • Connection timed out after 120000ms for the S3Adapter

I think this unpredictable behavior is a bug that should be fixed to save debugging time as the first responses was empty in my cases, so I didn't know there was a timeout issue.
Also note that sometimes, the timeout error log on the server can appear after (a few minutes) the Curl command returns and indicates that response is empty.

Can anyone provide me some answers about this :

  • Should not the return code always be 124?
  • Is there a way to avoid the timeout for file saving operations? If not, should not one be provided?

Steps to reproduce

  • My internet connection upload speed is 0.3Mbps
  • File to upload is a text file of 19MB I created for test purpose
  • Curl command:
    curl -X POST
    -H "X-Parse-Application-Id: APP_ID"
    -H "X-Parse-Master-Key: MASTER_KEY"
    -H "Content-Type: text/plain"
    -d "@file.txt"
    http://localhost:1337/parse/files/file.txt

Expected Results

File successfully created as the file is under the 20MB limit.

Actual Outcome

Either an empty response or code 130 "Could not store file.", randomly.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.3.7, 2.3.8, 2.4.0
    • Operating System: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): localhost
  • Database

    • MongoDB version: 3.0.10
    • Storage engine: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): AWS

Logs/Trace

With GridStoreAdapter:
connection 6 to ... timed out MongoError: connection 6 to ... timed out
at Function.MongoError.create (/Users/.../dist/node_modules/mongodb-core/lib/error.js:29:11)
at Socket. (/Users/.../dist/node_modules/mongodb-core/lib/connection/connection.js:188:20)
at Socket.g (events.js:291:16)
at emitNone (events.js:86:13)
at Socket.emit (events.js:185:7)
at Socket._onTimeout (net.js:339:8)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)

With S3Adapter:
Connection timed out after 120000ms TimeoutError: Connection timed out after 120000ms
at ClientRequest. (/Users/.../dist/node_modules/aws-sdk/lib/http/node.js:83:34)
at ClientRequest.g (events.js:291:16)
at emitNone (events.js:86:13)
at ClientRequest.emit (events.js:185:7)
at TLSSocket.emitTimeout (_http_client.js:626:10)
at TLSSocket.g (events.js:291:16)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket.Socket._onTimeout (net.js:339:8)
at ontimeout (timers.js:365:14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions