Comments (2)
This error indicates that Go-Chi, is hitting the stack size limit of a goroutine. Goroutines are lightweight concurrency units used in Go to execute concurrent tasks efficiently.
This error usually occurs when there's a high number of recursive calls or when the goroutine stack is being consumed by memory-intensive operations. The default stack size limit in Go is 1GB.
Here are some suggestions to address this issue:
-
Avoid Deep Recursion: If you're using recursion in your code, try to optimize it or convert it to an iterative approach.
-
Use Pooling: If you're creating many goroutines, consider using goroutine pools to reuse the same goroutines instead of creating new ones whenever needed. This can help reduce the overhead of goroutine creation and destruction.
-
Limit Concurrency: If you're processing many operations concurrently, try to limit the number of active goroutines at the same time. This can be done using semaphores or channels to control concurrency.
-
Increase Stack Size: While not the most recommended solution, it's possible to increase the goroutine stack size using the
GODEBUG
environment variable. However, this should be done carefully, as increasing the stack size too much can lead to performance issues and excessive memory consumption. -
Review Code: Review the code for possible memory leaks or memory usage patterns that might be causing the problem. Check if there are data structures that are growing without bounds or if there are reference cycles preventing memory from being released.
-
Memory Profiling: Use Go's profiling tools, such as the
pprof
package, to identify where most of the memory is being allocated and to understand memory allocation patterns in your code.
Keep in mind that solving this issue can vary depending on the context of your code and the application you're developing. Sometimes, it's necessary to make some changes to the code's design or architecture to avoid excessive memory consumption.
from chi.
Sounds like you have bug in your program that’s perpetually consuming memory potentially with some faulty custom middleware
from chi.
Related Issues (20)
- Unexpected Group behaviour HOT 1
- Can we log panics in one line? HOT 1
- log/slog's LogAttrs (and other methods) now requires a context as their first argument HOT 3
- Brotli compression not working
- Feature: Expose Context.methodsAllowed for use by MethodNotAllowedHandler
- Feature: on Go 1.22, fill `(*http.Request).PathValue` with URLParam data HOT 5
- Incorrect Route Matching Comment in chi.go
- [Doubt] Do you support i18n? HOT 4
- Possible bug can lead to security issue HOT 4
- URL params are not available inside middleware on the root router HOT 4
- Is jwtauth to validate jwt ? or can I create new jwt tokens using jwtauth? HOT 1
- Feature: on Go 1.22 pattern can start with an optional HTTP Method HOT 5
- bug: HandlerFunc does not support HTTP methods in patterns like #897
- Huma not respecting API Gateway path? HOT 1
- r.With(paginate) in documentation HOT 1
- When registering a custom Middleware and a custom NotFoundHandler, both are executed when a 404 URL is loaded HOT 1
- Custom middleware recovery having to be duplicated HOT 1
- How to pass information back to middleware? HOT 3
- v5 response does not implement http.Hijacker HOT 2
- High CPU usage by chi.setPathValue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chi.