[
https://issues.apache.org/jira/browse/THRIFT-4245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16075306#comment-16075306
]
Jens Geyer commented on THRIFT-4245:
------------------------------------
GitHub user pirDOL opened a pull request:
https://github.com/apache/thrift/pull/1303
fix framed_transport memory increase when write transport failed
if p.transport.Write fails, p.buf will not be truncated, which leads to
unexpected increasing of thrift client's memory.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/pirDOL/thrift master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/1303.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1303
----
commit f94091037b8c0f0aef5a849b79446dfbe0559175
Author: liduo04 <[email protected]>
Date: 2017-07-05T14:01:44Z
fix framed_transport memory increase when write transport failed
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
> 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
>
> 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)