Skip to content

Commit

Permalink
Fixcontextleaks (#53)
Browse files Browse the repository at this point in the history
* fix Context leaks

* move versiong into the separated file

* bump version
  • Loading branch information
halturin authored Jun 30, 2021
1 parent 7f52642 commit b9e151b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 0 additions & 4 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ const (
defaultRecvQueueLength int = 100
defaultFragmentationUnit = 65000

versionOTP int = 22
versionERTSprefix = "ergo"
version = "1.1.0"

// TLSmodeDisabled no TLS encryption
TLSmodeDisabled TLSmodeType = ""
// TLSmodeAuto generate self-signed certificate
Expand Down
1 change: 1 addition & 0 deletions process.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func (p *Process) SendAfter(to interface{}, message etf.Term, after time.Duratio
// to prevent of timer leaks due to its not GCed until the timer fires
timer := time.NewTimer(after)
defer timer.Stop()
defer cancel()

select {
case <-ctx.Done():
Expand Down
2 changes: 2 additions & 0 deletions registrar.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func (r *registrar) UnregisterProcess(pid etf.Pid) {
}
}
r.mutexProcesses.Unlock()
// invoke cancel context to prevent memory leaks
p.Kill()
return
}
r.mutexProcesses.Unlock()
Expand Down
7 changes: 7 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ergo

const (
versionOTP int = 22
versionERTSprefix = "ergo"
version = "1.2.4"
)

0 comments on commit b9e151b

Please sign in to comment.