Wilfred Spiegelenburg created YUNIKORN-64:
---------------------------------------------
Summary: Add zap encoders for time and duration
Key: YUNIKORN-64
URL: https://issues.apache.org/jira/browse/YUNIKORN-64
Project: Apache YuniKorn
Issue Type: Task
Components: core - common
Reporter: Wilfred Spiegelenburg
In YUNIKORN-62 a nil pointer caused a panic. The fix was to change the log call
from a Duration to a String.
The real issue is the fact that the encoders for certain types are not set in
the logger. This is most likely an OS or internationalisation configuration
related issue. In the code we fail here:
{code}
panic: runtime error: invalid memory address or nil pointer dereference[signal
SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11ac568] goroutine 51
[running]:go.uber.org/zap/zapcore.(*jsonEncoder).AppendDuration(0xc007eca390,
0x77370eba)
/Users/wyang/go/pkg/mod/go.uber.org/[email protected]/zapcore/json_encoder.go:239
{code}
That links to the source code here:
{code}
237 func (enc *jsonEncoder) AppendDuration(val time.Duration) {
238 cur := enc.buf.Len()
239 enc.EncodeDuration(val, enc)
{code}
That can only happen if the {{EncodeDuration}} function is nil.
This links back to a similar [zap issue
#645|https://github.com/uber-go/zap/issues/645] for time stamps. In the
comments it says that the encoders are not optional for certain parts. We
should make sure that the encoders are set correctly as that looks like it is
the correct solution.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]