You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2017/07/05 20:24:00 UTC

[jira] [Resolved] (THRIFT-4245) Golang TFramedTransport's writeBuffer increases if writes to transport failed

     [ https://issues.apache.org/jira/browse/THRIFT-4245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer resolved THRIFT-4245.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 0.11.0

LGTM, committed.

> Golang TFramedTransport's writeBuffer increases if writes to transport failed
> -----------------------------------------------------------------------------
>
>                 Key: THRIFT-4245
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4245
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: pirDOL
>             Fix For: 0.11.0
>
>
> https://github.com/apache/thrift/blob/master/lib/go/thrift/framed_transport.go#L143
> if p.transport.Write fails, p.buf will not be truncated, which leads to thrift client's memory increasing forever. 
> Is it more reasonable to truncate p.buf when write to transport fails? here are my pull request, https://github.com/apache/thrift/pull/1303
> i'm new in github&jira, if more details are needed, please tell me, thx.
> {code:none}
> func (p *TFramedTransport) Flush() error {
> 	size := p.buf.Len()
> 	buf := p.buffer[:4]
> 	binary.BigEndian.PutUint32(buf, uint32(size))
> 	_, err := p.transport.Write(buf)
> 	if err != nil {
> 		return NewTTransportExceptionFromError(err)
> 	}
> 	if size > 0 {
> 		if n, err := p.buf.WriteTo(p.transport); err != nil {
> 			print("Error while flushing write buffer of size ", size, " to transport, only wrote ", n, " bytes: ", err.Error(), "\n")
> 			return NewTTransportExceptionFromError(err)
> 		}
> 	}
> 	err = p.transport.Flush()
> 	return NewTTransportExceptionFromError(err)
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)