Skip to content

Commit 56edb77

Browse files
committed
[core] fix a recursive mutex locking in task
Fixes a bug reported in OCTRL-999.
1 parent c996381 commit 56edb77

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

core/task/task.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,16 @@ func (t *Task) GetTraits() Traits {
251251
return Traits{}
252252
}
253253

254+
// lock-free version of GetTraits
255+
func (t *Task) getTraits() Traits {
256+
if class := t.GetTaskClass(); class != nil {
257+
if t.parent != nil {
258+
return t.parent.GetTaskTraits()
259+
}
260+
}
261+
return Traits{}
262+
}
263+
254264
// Returns a consolidated CommandInfo for this Task, based on Roles tree and
255265
// Class.
256266
func (t *Task) BuildTaskCommand(role parentRole) (err error) {
@@ -525,7 +535,7 @@ func (t *Task) SendEvent(ev event.Event) {
525535
Hostname: t.hostname,
526536
ClassName: t.className,
527537
Path: t.getParentRolePath(),
528-
Traits: traitsToPbTraits(t.GetTraits()),
538+
Traits: traitsToPbTraits(t.getTraits()),
529539
}
530540

531541
if t.parent == nil {

0 commit comments

Comments
 (0)