[ 
https://issues.apache.org/jira/browse/TINKERPOP-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17700325#comment-17700325
 ] 

ASF GitHub Bot commented on TINKERPOP-2905:
-------------------------------------------

disq commented on code in PR #1990:
URL: https://github.com/apache/tinkerpop/pull/1990#discussion_r1135989789


##########
gremlin-go/driver/transporterFactory.go:
##########
@@ -31,11 +31,17 @@ const (
        Gorilla TransporterType = iota + 1
 )
 
-func getTransportLayer(transporterType TransporterType, url string, 
connSettings *connectionSettings) (transporter, error) {
+func getTransportLayer(transporterType TransporterType, url string, 
connSettings *connectionSettings, logHandler *logHandler) (transporter, error) {
        var transporter transporter
        switch transporterType {
        case Gorilla:
-               transporter = &gorillaTransporter{url: url, connSettings: 
connSettings, writeChannel: make(chan []byte, writeChannelSizeDefault), wg: 
&sync.WaitGroup{}}
+               transporter = &gorillaTransporter{
+                       url:          url,
+                       logHandler:   logHandler,

Review Comment:
   The whole block was reformatted and `logHandler` was added.





> 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
>            Priority: Major
>              Labels: go
>
> 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)

Reply via email to