Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fatal][nodejs] “Error: Unexpected end of form” after multiple post file formdata, and then hang up after multiple error happening #6338

Closed
luoxzhg opened this issue Apr 2, 2024 · 3 comments

Comments

@luoxzhg
Copy link

luoxzhg commented Apr 2, 2024

Describe the bug

“Error: Unexpected end of form” after multiple post file formdata,
and then hang up after multiple error happening

server using multer v1.4.5-lts accepts files, raise this error. uploading file with other tool (jmeter) no such errors

图片

To Reproduce

nodejs v20.10.0
axios v1.6.8
form-data v4.0.0

const axios = Axios.create({
    httpAgent: new http.Agent({ keepAlive: true, keepAliveMsecs: 30000 }),
    httpsAgent: new https.Agent({ keepAlive: true, keepAliveMsecs: 30000 }),
    maxContentLength: Infinity,
    maxBodyLength: Infinity,
})

response json is big, 20MB

Code snippet

No response

Expected behavior

successed request

Axios Version

1.6.8

Adapter Version

http

Browser

No response

Browser Version

No response

Node.js Version

20.10

OS

apline

Additional Library Versions

form-data v4.0.0

Additional context/Screenshots

No response

@luoxzhg
Copy link
Author

luoxzhg commented Apr 2, 2024

tested with v1.6.7, same issue;
v1.6.6, much less Unexpected end of form error than v1.6.7, v1.6.8, and never hang up

@luoxzhg
Copy link
Author

luoxzhg commented Apr 2, 2024

v1.6.6 raise some new Error

=====================>>> Tue Apr 02 2024 10:21:24 GMT+0000 (Coordinated Universal Time)
TypeError: Cannot read properties of undefined (reading 'endsWith')
    at Axios.request (/app/server/node_modules/.pnpm/axios@1.6.6_debug@4.3.4/node_modules/axios/dist/node/axios.cjs:3886:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _extractText (/app/server/src/apis/extract-text.js:42:22)
    at async Object.extractTextWithPosition (/app/server/src/apis/extract-text.js:60:24)
    at async extractTextWithPosition (/app/server/src/lib/extract-text.js:43:22)
    at async /app/server/src/v3/router.js:111:17
<<<=====================

@luoxzhg luoxzhg changed the title 【formData】“Error: Unexpected end of form” after multiple post file formdata, and then hang up after multiple error happening 【nodejs】“Error: Unexpected end of form” after multiple post file formdata, and then hang up after multiple error happening Apr 2, 2024
@luoxzhg luoxzhg changed the title 【nodejs】“Error: Unexpected end of form” after multiple post file formdata, and then hang up after multiple error happening [fatal][nodejs] “Error: Unexpected end of form” after multiple post file formdata, and then hang up after multiple error happening Apr 2, 2024
@luoxzhg
Copy link
Author

luoxzhg commented Apr 8, 2024

this is my mistake. multiply threads read/write same file casue this.

@luoxzhg luoxzhg closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant