Skip to content

THRIFT-3765 fix memory leak in python compact protocol extension#970

Closed
ccmaymay wants to merge 1 commit intoapache:masterfrom
ccmaymay:THRIFT-3765
Closed

THRIFT-3765 fix memory leak in python compact protocol extension#970
ccmaymay wants to merge 1 commit intoapache:masterfrom
ccmaymay:THRIFT-3765

Conversation

@ccmaymay
Copy link
Contributor

This fixes a significant memory leak in the new Python extension module for the compact protocol.

@nsuke
Copy link
Member

nsuke commented Mar 28, 2016

@cjmay thanks for catching this before the release.
C extension + UTF8 fix seems to be the true culprit here (so it's even much more worse in terms of the scope of this regression).

@@ -431,6 +433,7 @@ bool ProtocolBase<Impl>::encodeValue(PyObject* value, TType type, PyObject* type
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need DECREF before the "return false" above too.
Feel free to use ScopedPyObject (or not).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so too, originally, but isn't value null there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be...
The value is either null-checked or passed to Py_INCREF that does not accept null.
The intention here is to simply reject too long string values.
If you experienced null value here, we'll need to investigate on that matter too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I apologize, I was looking at the wrong "return false."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, and thanks for the tip.

@ccmaymay
Copy link
Contributor Author

Thank you! We were excited to see this extension get written.

@nsuke
Copy link
Member

nsuke commented Mar 29, 2016

Committed, thanks again for the fix.

tpcwang pushed a commit to tpcwang/thrift that referenced this pull request Jun 14, 2016
allengeorge pushed a commit to allengeorge/thrift that referenced this pull request Jan 1, 2017
gadLinux pushed a commit to gadLinux/thrift that referenced this pull request Jan 24, 2017
ngrewe pushed a commit to ngrewe/thrift that referenced this pull request Jan 31, 2017
ngrewe pushed a commit to ngrewe/thrift that referenced this pull request Jan 31, 2017
jeking3 pushed a commit to jeking3/thrift that referenced this pull request Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants