openresty / openresty/lua-resty-upload

Got "closed" error after call read method of resty.upload

Open
#57 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
414
Forks
110
Avg merge
2h 43m
Merged PRs (30d)
1

Description

Hi, I encountered an occasional problem in a http request, the following is the sample code

local upload = require "resty.upload"
local form, err = upload.new(4 * 1024)

****

form:set_timeout(5000)

local typ, res, err = form:read()

The value of err is "closed", then server return a message(by using ngx.print and ngx.exit(ngx.HTTP_OK)) and client can receive it. It seems that the socket was closed but client can still get the return of server

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the resty.upload sample in the issue, especially form:read() after set_timeout(5000), and trace how the "closed" error is produced. Reproduce the occasional response and compare the read error with the server's ngx.print and ngx.exit behavior; done means the behavior is explained and the issue has a verified fix or documented expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.