Skip to content

Request hangs with 100% CPU usage when route has a path param and URL is terminated with "/" #1510

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

Closed
3 tasks done
gnyekhelyi opened this issue Feb 19, 2020 · 2 comments
Closed
3 tasks done
Labels

Comments

@gnyekhelyi
Copy link

Issue Description

Request hangs (no response), the server process has 100% CPU usage when route has a path parameter (e.g.: "/users/:id") and URL is terminated with "/"

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

404 error

Actual behaviour

Request hangs, causing the server process to use 100% CPU

Steps to reproduce

curl localhost:8080/users/123/

Working code to debug

package main

import (
	"github.com/labstack/echo/v4"
	"net/http"
)

func main() {
	e := echo.New()
	e.GET("/users/:id", func(c echo.Context) error {
		id := c.Param("id")
		return c.String(http.StatusOK, "id=" + id)
	})
	e.Logger.Fatal(e.Start(": 8080"))
}

Version/commit

v4.1.14

@lammel
Copy link
Contributor

lammel commented Feb 19, 2020

This is a duplicate of #1503 and #1493 which is fixed by PR #1501 already.

For a workaround see #1503, will be fixed in the next release.

@stale
Copy link

stale bot commented Apr 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 19, 2020
@stale stale bot closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants