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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Logger not logging abrupt TCP Resets on large body requests #743

Closed
DarthBenro008 opened this issue Aug 28, 2020 · 1 comment
Closed

Comments

@DarthBenro008
Copy link
Contributor

DarthBenro008 commented Aug 28, 2020

Fiber version 1.14.4 running on Go1.14.6

Issue description
TCP Gets Shutdown abruptly when multipart with relatively huge size file is passed with default Fiber Settings on server side.

Steps to reproduce:

  • Run the snippet below
  • Send a multipart with relatively huge file as payload

I noticed that when you send a file let's say 20-30mb in multipart from Postman you get an ECONNRESET error instead of the "Entity Too Large" Response .

image

I was puzzled with this issue as I forgot to increase the body limit in Go Fiber App Settings , however thanks to @renanbastos93 for helping me out in the discord channel.

Real Issue :
On Further Investigation , i found out native fasthttp behaves the same , but informs us in the terminal about the abrupt connection reset which the GoFiber Logger Middleware doesn't . Would be really helpful if this is added in logger to make it easier to debug.

Code snippet

func main() {
	app := fiber.New()

	app.Get("/", func(c *fiber.Ctx) {
		c.Send("Hello, World 馃憢!")
	})

	app.Post("/api", func(c *fiber.Ctx) {
		file, _ := c.FormFile("file")
		c.SaveFile(file, file.Filename)
	})

	app.Listen(3000)
}
@ReneWerner87
Copy link
Member

ReneWerner87 commented Aug 31, 2020

we could trace the problem back to postman, please search in the existing posts for a solution or open a new one

postmanlabs/postman-app-support#2214
https://github.com/postmanlabs/postman-app-support/issues?q=is%3Aissue+ECONNRESET

with direct curl requests the application will give the response
image

please use this for logging output

app.Use(middleware.Logger("#${pid} - ${time} ${status} - ${latency} ${method} ${path} ${error}\n"))

additionally we found out that the postman problem is time related, if we include a small delay in the output within fasthttp, postman can read the answer correctly
image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants