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

Created on 19 Feb 2020  路  2Comments  路  Source: labstack/echo

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

  • [x] Dependencies installed
  • [x] No typos
  • [x] 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

wontfix

Most helpful comment

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.

All 2 comments

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

toorop picture toorop  路  4Comments

linux-support picture linux-support  路  3Comments

neutronstein picture neutronstein  路  3Comments

ellisonleao picture ellisonleao  路  3Comments

danieldaeschle picture danieldaeschle  路  3Comments