All Projects β†’ fortytw2 β†’ Leaktest

fortytw2 / Leaktest

Licence: bsd-3-clause
Goroutine Leak Detector

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Leaktest

noroutine
Goroutine analogue for Node.js, spreads I/O-bound routine calls to utilize thread pool (worker_threads) using balancer with event loop utilization. 🌱
Stars: ✭ 86 (-90.14%)
Mutual labels:  goroutine
gospy
Non-Invasive goroutine inspector
Stars: ✭ 85 (-90.25%)
Mutual labels:  goroutine
Blog
Jiajunηš„ηΌ–η¨‹ιšζƒ³
Stars: ✭ 528 (-39.45%)
Mutual labels:  goroutine
go-workshops
Go language basic workshops for devz
Stars: ✭ 68 (-92.2%)
Mutual labels:  goroutine
gohive
🐝 A Highly Performant and easy to use goroutine pool for Go
Stars: ✭ 41 (-95.3%)
Mutual labels:  goroutine
Goroutine Inspect
An interactive tool to analyze Golang goroutine dump.
Stars: ✭ 272 (-68.81%)
Mutual labels:  goroutine
errgroup
errgroup with goroutine worker limits
Stars: ✭ 143 (-83.6%)
Mutual labels:  goroutine
Grpool
Lightweight Goroutine pool
Stars: ✭ 616 (-29.36%)
Mutual labels:  goroutine
goroutines
provides utilities to perform common tasks on goroutines
Stars: ✭ 19 (-97.82%)
Mutual labels:  goroutine
Golang runtime reading
golang 1.10.2 runtime code reading - golang runtimeζΊη εˆ†ζžγ€‚εͺζœ‰ζ€θ€ƒθΏ‡οΌŒδ½ ζ‰δΌšε°θ±‘ζ·±εˆ»γ€‚
Stars: ✭ 393 (-54.93%)
Mutual labels:  goroutine
chanbroker
ChanBroker, a Broker for goroutine, is simliar to kafka
Stars: ✭ 61 (-93%)
Mutual labels:  goroutine
retrygroup
Package retrygroup provides synchronization, Context cancelation for groups of retry goroutines working on subtasks of a common task.
Stars: ✭ 18 (-97.94%)
Mutual labels:  goroutine
Reading
ζ•΄η†ι˜…θ―»θΏ‡ηš„εΉ²θ΄§ζ–‡η« , 帖子
Stars: ✭ 318 (-63.53%)
Mutual labels:  goroutine
ecs
Build your own Game-Engine based on the Entity Component System concept in Golang.
Stars: ✭ 68 (-92.2%)
Mutual labels:  goroutine
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (-38.99%)
Mutual labels:  goroutine
context
A proof of concept implementation of scoped context
Stars: ✭ 16 (-98.17%)
Mutual labels:  goroutine
cocoyaxi
A go-style coroutine library in C++11 and more.
Stars: ✭ 2,392 (+174.31%)
Mutual labels:  goroutine
Go spider
A golang spider
Stars: ✭ 25 (-97.13%)
Mutual labels:  goroutine
Ants
🐜🐜🐜 ants is a high-performance and low-cost goroutine pool in Go, inspired by fasthttp./ ants ζ˜―δΈ€δΈͺι«˜ζ€§θƒ½δΈ”δ½ŽζŸθ€—ηš„ goroutine 池。
Stars: ✭ 7,180 (+723.39%)
Mutual labels:  goroutine
Machine
Machine is a zero dependency library for highly concurrent Go applications. It is inspired by errgroup.Group with extra bells & whistles
Stars: ✭ 346 (-60.32%)
Mutual labels:  goroutine

Leaktest Build Status codecov Sourcegraph Documentation

Refactored, tested variant of the goroutine leak detector found in both net/http tests and the cockroachdb source tree.

Takes a snapshot of running goroutines at the start of a test, and at the end - compares the two and voila. Ignores runtime/sys goroutines. Doesn't play nice with t.Parallel() right now, but there are plans to do so.

Installation

Go 1.7+

go get -u github.com/fortytw2/leaktest

Go 1.5/1.6 need to use the tag v1.0.0, as newer versions depend on context.Context.

Example

These tests fail, because they leak a goroutine

// Default "Check" will poll for 5 seconds to check that all
// goroutines are cleaned up
func TestPool(t *testing.T) {
    defer leaktest.Check(t)()

    go func() {
        for {
            time.Sleep(time.Second)
        }
    }()
}

// Helper function to timeout after X duration
func TestPoolTimeout(t *testing.T) {
    defer leaktest.CheckTimeout(t, time.Second)()

    go func() {
        for {
            time.Sleep(time.Second)
        }
    }()
}

// Use Go 1.7+ context.Context for cancellation
func TestPoolContext(t *testing.T) {
    ctx, cancel := context.WithTimeout(context.Background(), time.Second)
    defer cancel()
    defer leaktest.CheckContext(ctx, t)()

    go func() {
        for {
            time.Sleep(time.Second)
        }
    }()
}

LICENSE

Same BSD-style as Go, see LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].