Jens Geyer created THRIFT-6297:
----------------------------------

             Summary: Go: TTransportFactoryConf and TProtocolFactoryConf pass 
the previous TConfiguration to their delegate
                 Key: THRIFT-6297
                 URL: https://issues.apache.org/jira/browse/THRIFT-6297
             Project: Thrift
          Issue Type: Bug
          Components: Go - Library
            Reporter: Jens Geyer


{{SetTConfiguration}} on the wrappers that {{TTransportFactoryConf}} and 
{{TProtocolFactoryConf}} return ({{lib/go/thrift/configuration.go}}) passes the 
wrapper's old configuration to its delegate. Only after that does it store the 
new one:

{code:go}
func (f *tTransportFactoryConf) SetTConfiguration(cfg *TConfiguration) {
        PropagateTConfiguration(f.delegate, f.cfg)
        f.cfg = cfg
}
{code}

{{tProtocolFactoryConf}} has the same two lines, so the delegate factory keeps 
the previous configuration. Transports and protocols created later still 
receive the new one, because {{GetTransport}} and {{GetProtocol}} propagate 
{{f.cfg}} to whatever the delegate returns. What the delegate itself does with 
its configuration while building them still uses the old one.

THRIFT-6280 fixed the same pattern in {{THeaderTransportFactory}}.

h2. Suggested

Propagate {{cfg}} instead of {{f.cfg}}. Add a test that sets a configuration on 
each wrapper and checks the delegate's configuration.

_Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens Geyer._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to