Skip to content

Bug: fasthttp.RequestCtx panic #2026

Description

@deanz-io
package main

import (
	"context"
	"time"

	"github.com/valyala/fasthttp"
)

func main() {
	fctx := &fasthttp.RequestCtx{}

	_, cancel := context.WithTimeout(fctx, time.Second)
	defer cancel()
}

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x160 pc=0x8baa27]

goroutine 1 [running]:
github.com/valyala/fasthttp.(*RequestCtx).Done(0x70?)
C:/Users/zhang/go/pkg/mod/github.com/valyala/[email protected]/server.go:2830 +0x7
context.(*cancelCtx).propagateCancel(0xc000146000, {0x9ac670, 0xc000144008}, {0x9abde0, 0xc000146000})
C:/Program Files/Go/src/context/context.go:469 +0x75
context.WithDeadlineCause({0x9ac670, 0xc000144008}, {0xb25520?, 0x3b9aca00?, 0xb25520?}, {0x0, 0x0})
C:/Program Files/Go/src/context/context.go:634 +0x12b
context.WithDeadline(...)
C:/Program Files/Go/src/context/context.go:617
context.WithTimeout({0x9ac670, 0xc000144008}, 0x3b9aca00)
C:/Program Files/Go/src/context/context.go:695 +0x4d
main.main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions