goodhawk
goodhawk8mo ago

Connection aborted with the large request body

with the large request body, it will happen the "Connection aborted"
def writeAiResultDoc(data):
apiUrl = resource['LANGCHAIN_ERPNEXT_DEV_API_BASIS_URL']
url = f"{apiUrl}/resource/ResearchFee Initial Evaluation"

headers = {
"Authorization": resource['LANGCHAIN_ERPNEXT_DEV_API_KEY']
}

# data['business_type'] = '精测'

body = data
print(url)
print(headers)
# return 0
response = requests.post(url,json=body, headers=headers)

if response.status_code == 200:
# result = response.json()
return 1
else:
error_msg = f"请求失败 - Header: { response.headers } 状态码: {response.status_code},原因: {response.text}"
print(error_msg) # 输出错误日志
return 0
def writeAiResultDoc(data):
apiUrl = resource['LANGCHAIN_ERPNEXT_DEV_API_BASIS_URL']
url = f"{apiUrl}/resource/ResearchFee Initial Evaluation"

headers = {
"Authorization": resource['LANGCHAIN_ERPNEXT_DEV_API_KEY']
}

# data['business_type'] = '精测'

body = data
print(url)
print(headers)
# return 0
response = requests.post(url,json=body, headers=headers)

if response.status_code == 200:
# result = response.json()
return 1
else:
error_msg = f"请求失败 - Header: { response.headers } 状态码: {response.status_code},原因: {response.text}"
print(error_msg) # 输出错误日志
return 0
ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
File "/tmp/windmill/wk-default-abe5b65c9b69-hy248/018e0dfe-a3eb-c72d-aca9-367bd8620e38/u/goodhawk/dazzling_script.py", line 153, in main
r2 = writeAiResultDoc(data)
^^^^^^^^^^^^^^^^^^^^^^
ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
File "/tmp/windmill/wk-default-abe5b65c9b69-hy248/018e0dfe-a3eb-c72d-aca9-367bd8620e38/u/goodhawk/dazzling_script.py", line 153, in main
r2 = writeAiResultDoc(data)
^^^^^^^^^^^^^^^^^^^^^^
3 Replies
goodhawk
goodhawk8mo ago
I have research the ticket https://github.com/windmill-labs/windmill/issues/1772 with the setting REQUEST_SIZE_LIMIT=10000000000 but there is no useful.
GitHub
bug: Getting error on uploading CSV file > 1 mb · Issue #1772 · wi...
Describe the bug I am getting an error if CSV file greater than 1mb is uploaded To reproduce Go to scripts and add Python script Trying to upload a csv file > 1mb in default example Click Run Ex...
rubenf
rubenf8mo ago
are you on cloud or self-hosted ? on cloud, you cannot set the request size limit it's limited at 2MB to avoid abuse
goodhawk
goodhawk8mo ago
self-hosted and has added the paramters:
windmill_server:
image: ${WM_IMAGE}
pull_policy: always
deploy:
replicas: 1
restart: unless-stopped
expose:
- 8000
environment:
- REQUEST_SIZE_LIMIT=10000000000
- DATABASE_URL=${DATABASE_URL}
- MODE=server
depends_on:
db:
condition: service_healthy
windmill_server:
image: ${WM_IMAGE}
pull_policy: always
deploy:
replicas: 1
restart: unless-stopped
expose:
- 8000
environment:
- REQUEST_SIZE_LIMIT=10000000000
- DATABASE_URL=${DATABASE_URL}
- MODE=server
depends_on:
db:
condition: service_healthy
this is my post data : https://gist.githubusercontent.com/guinanlin/a7e5d8f344f4937fb7eccc940be133ec/raw/954d95e4c5ace92034334c3d9aa40c0b0dd9de3b/postdata.json The same method works as I am able to successfully invoke it using Postman, other API tools, and a Vue3 project.