From 6eebe8c9f456d67e69b1e71e92e00e0f399f035c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Thu, 16 Jan 2020 10:28:01 +0100 Subject: [PATCH] Only log the errors from observers Because we call the observers concurrently, we must not write to S.err inside the goroutines. For now, we simply log an error from an observer. --- GetRuntimeAddresses/symbolyze/symbolyze.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/GetRuntimeAddresses/symbolyze/symbolyze.go b/GetRuntimeAddresses/symbolyze/symbolyze.go index 79af466..33cfee4 100644 --- a/GetRuntimeAddresses/symbolyze/symbolyze.go +++ b/GetRuntimeAddresses/symbolyze/symbolyze.go @@ -102,8 +102,7 @@ func (S *Scanner) OnFound(fun Observer) { // // Run will return an error if it couldn't read the proc filesystem. Otherwise // it will try to continue to loop over all pids, writing potential errors to -// the console. Errors from the observer functions are also logged and the -// final such error is the return value of Run(). +// the console. Errors from the observer functions are logged. func (S *Scanner) Run() error { if S.err != nil { return S.err @@ -141,8 +140,8 @@ func (S *Scanner) Run() error { go func() { err = observer(pid, offset) if err != nil { - S.setErrorf("S.observer[%d] error: %v", n, err) - // TODO: propagate errors from all Observers. + S.Printf("S.observer[%d](%d, %d) error: %v", n, pid, offset, err) + // TODO: accumulate errors from all Observers. } wg.Done() }()