Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/egonelbre/antifreeze
antifreeze is a package that detects goroutines that have been waiting for too long
https://github.com/egonelbre/antifreeze
Last synced: 8 days ago
JSON representation
antifreeze is a package that detects goroutines that have been waiting for too long
- Host: GitHub
- URL: https://github.com/egonelbre/antifreeze
- Owner: egonelbre
- License: unlicense
- Created: 2015-10-17T09:51:37.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-08-27T10:51:36.000Z (about 3 years ago)
- Last Synced: 2024-06-20T16:48:26.240Z (5 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 20
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# antifreeze
antifreeze is a package that detects goroutines that have been waiting for too long.
**Warning: this package is alpha and may not work as intended.**
You can exclude functions that may block forever with `antifreeze.Exclude` and `antifreeze.ExcludeNamed`.
Example program that will panic ~1min after you have made a request to it.
``` go
package mainimport (
"fmt"
"net/http"
"time""github.com/egonelbre/antifreeze"
)func init() {
antifreeze.SetFrozenLimit(1 * time.Minute)
}var ch = make(chan int)
func runner() {
antifreeze.Exclude()
<-ch
}func main() {
go runner()
http.Handle("/", http.HandlerFunc(index))
http.ListenAndServe(":8000", nil)
}func index(w http.ResponseWriter, r *http.Request) {
fmt.Println("R:", r)
<-ch
}
```See [godoc](https://godoc.org/github.com/egonelbre/antifreeze) for more information.