Kemal Hadimli created TINKERPOP-2905:
----------------------------------------
Summary: gremlin-go gorillaTransporter.logHandler is not
initialized correctly and leads to panic
Key: TINKERPOP-2905
URL: https://issues.apache.org/jira/browse/TINKERPOP-2905
Project: TinkerPop
Issue Type: Bug
Components: go
Affects Versions: 3.5.0
Reporter: Kemal Hadimli
Whenever the gorillaTransporter needs to write a log message we get a nil
dereference error:
{code:java}
panic: runtime error: invalid memory address or nil pointer dereference [signal
SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x710432]goroutine 22
[running]:
github.com/nicksnyder/go-i18n/v2/i18n.(*Localizer).getMessageTemplate(0x0,
{0xc4a40c, 0x17}, 0x0)
/Users/disq/go/pkg/mod/github.com/nicksnyder/go-i18n/[email protected]/i18n/localizer.go:182
+0x32 github.com/nicksnyder/go-i18n/v2/i18n.(*Localizer).LocalizeWithTag(0xb?,
0xc000092e68)
/Users/disq/go/pkg/mod/github.com/nicksnyder/go-i18n/[email protected]/i18n/localizer.go:158
+0x29b github.com/nicksnyder/go-i18n/v2/i18n.(*Localizer).Localize(...)
/Users/disq/go/pkg/mod/github.com/nicksnyder/go-i18n/[email protected]/i18n/localizer.go:113
github.com/apache/tinkerpop/gremlin-go/v3/driver.(*logHandler).logf(0xc000241d68,
0x4, {0xc4a40c?, 0x0?}, {0xc003d3b520, 0x2, 0x2})
/Users/disq/Downloads/tinkerpop/gremlin-go/driver/logger.go:93 +0x8d
github.com/apache/tinkerpop/gremlin-go/v3/driver.(*gorillaTransporter).writeLoop(0xc000241d40)
/Users/disq/Downloads/tinkerpop/gremlin-go/driver/gorillaTransporter.go:189
+0x508 created by
github.com/apache/tinkerpop/gremlin-go/v3/driver.(*gorillaTransporter).Connect
/Users/disq/Downloads/tinkerpop/gremlin-go/driver/gorillaTransporter.go:90
+0x332
{code}
Since `logHandler` is not initialized with the constructor (zero value is used
instead) `logVerbosity` is not passed on and `localizer` is also `nil`. This
leads to a nil dereference error when the localizer is used in the logger.
Turning logging off (setting `logVerbosity` to `Off`) also doesn't work because
the verbosity value is also affected and not passed on.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)