Skip to content

Embedding golang context can cause stack overflows #669

@ansel1

Description

@ansel1

Description

In a handler:

c.SetStdContext(context.WithValue(c, "key", "red"))
c.Value("key")  // that's fine
c.Value("notkey") // stack overflow!

I don't think you should embed the context unfortunately. Too easy for this to happen.

It seems like implementations of Context really need to be immutable.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions