-
Notifications
You must be signed in to change notification settings - Fork 4
include current limits in debug messages #42
Conversation
@marten-seemann : can you please post an example error message before vs now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the stat, its very useful.
59c71ed
to
bf5dd82
Compare
@vyzo Re-added the stat. @BigLep
after:
|
Actually, we shouldn't include the |
bf5dd82
to
6bdbf3a
Compare
Included the stat in a non-racy way (by collecting it at the same time we generate the error, while holding the mutex). This should be ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep the stat, i find it useful for context.
3d5d6c2
to
1910cf4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much noise, func the loggables bussiness pls.
scope.go
Outdated
@@ -239,7 +329,14 @@ func (s *resourceScope) ReserveMemory(size int, prio uint8) error { | |||
} | |||
|
|||
if err := s.rc.reserveMemory(int64(size), prio); err != nil { | |||
log.Debugw("blocked memory reservation", "scope", s.name, "size", size, "priority", prio, "stat", s.rc.stat(), "error", err) | |||
logValues := make([]interface{}, 0, 7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we abstract this in a function? It adds noise in the logic.
scope.go
Outdated
var stat network.ScopeStat | ||
stat, err = e.ReserveMemoryForChild(int64(size), prio) | ||
if err != nil { | ||
logValues := make([]interface{}, 0, 7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
scope.go
Outdated
@@ -344,7 +450,14 @@ func (s *resourceScope) AddStream(dir network.Direction) error { | |||
} | |||
|
|||
if err := s.rc.addStream(dir); err != nil { | |||
log.Debugw("blocked stream", "scope", s.name, "direction", dir, "stat", s.rc.stat(), "error", err) | |||
logValues := make([]interface{}, 0, 7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
scope.go
Outdated
var stat network.ScopeStat | ||
stat, err = e.AddStreamForChild(dir) | ||
if err != nil { | ||
logValues := make([]interface{}, 0, 8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
scope.go
Outdated
@@ -444,7 +566,14 @@ func (s *resourceScope) AddConn(dir network.Direction, usefd bool) error { | |||
} | |||
|
|||
if err := s.rc.addConn(dir, usefd); err != nil { | |||
log.Debugw("blocked connection", "scope", s.name, "direction", dir, "usefd", usefd, "stat", s.rc.stat(), "error", err) | |||
logValues := make([]interface{}, 0, 8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
booh
scope.go
Outdated
var stat network.ScopeStat | ||
stat, err = e.AddConnForChild(dir, usefd) | ||
if err != nil { | ||
logValues := make([]interface{}, 0, 8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and again!
@vyzo Moved to separate functions. The reason I chose to have separate functions for stream, conn and memory errors is that I want to avoid allocations: The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just a cosmetic issue.
scope.go
Outdated
@@ -18,6 +19,80 @@ type resources struct { | |||
memory int64 | |||
} | |||
|
|||
type errStreamOrConnLimitExceeded struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we put all that stuff at the bottom of the file?
New readers shouldnt be welcomed with an incomprehensible blob of logging arcana.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved it to a separate file.
Fixes #26.
Potentially controversial: also removes the
stat
from the debug output, to focus on the thing that is actually getting blocked. We can add it back if preferred.