lua-resty-upload icon indicating copy to clipboard operation
lua-resty-upload copied to clipboard

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

Open GeraltXLi opened this issue 5 years ago • 3 comments

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

GeraltXLi avatar Jul 21 '20 06:07 GeraltXLi

It's easiest to use OpenResty XRay to analyze such things. We can give you a free trial to track this down for you.

agentzh avatar Jul 21 '20 20:07 agentzh

I also have this problem

xiaoliu10 avatar Aug 27 '21 03:08 xiaoliu10

I want lua http client send file to lua server, i cannot find any example with lua-resty-http to send file , So I assembled the HTTP message myself and used the lua-resty-upload server to receive it. Similarly, an error is reported in form read, and err msg is sock is closed

xiaoliu10 avatar Aug 27 '21 03:08 xiaoliu10