Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python cpp_implementation segfaults during test #2724

Closed
yingzong opened this issue Feb 15, 2017 · 3 comments
Closed

Python cpp_implementation segfaults during test #2724

yingzong opened this issue Feb 15, 2017 · 3 comments

Comments

@yingzong
Copy link

yingzong commented Feb 15, 2017

Followed instructions here for OSX:
https://github.com/google/protobuf/tree/master/python

With latest version v3.2.0, got a segfault on this line of the test python setup.py test --cpp_implementation about once every two to four tries. It doesn't always happen, but when it happens it is always on this line.

testMergeFrom (google.protobuf.internal.message_test.Proto3Test) ... Segmentation fault: 11

trace from lldb:

frame #0: 0x0000000104ec52c1 _message.so`google::protobuf::python::cmessage::GetFieldDescriptor(google::protobuf::python::CMessage*, _object*) [inlined] google::protobuf::Message::GetDescriptor(this=0x00007f9132e86ad0) const + 3 at message.h:322
   319 	
   320 	  // Get a Descriptor for this message's type.  This describes what
   321 	  // fields the message contains, the types of those fields, etc.
-> 322 	  const Descriptor* GetDescriptor() const { return GetMetadata().descriptor; }
   323 	
   324 	  // Get the Reflection interface for this Message, which can be used to
   325 	  // read and modify the fields of the Message dynamically (in other words,
(lldb) up
frame #1: 0x0000000104ec52be _message.so`google::protobuf::python::cmessage::GetFieldDescriptor(self=<unavailable>, name=<unavailable>) + 14 at message.cc:986
   983 	// handling is not consistent.
   984 	static const FieldDescriptor* GetFieldDescriptor(
   985 	    CMessage* self, PyObject* name) {
-> 986 	  const Descriptor *message_descriptor = self->message->GetDescriptor();
   987 	  char* field_name;
   988 	  Py_ssize_t size;
   989 	  if (PyString_AsStringAndSize(name, &field_name, &size) < 0) {
(lldb) up
frame #2: 0x0000000104ec5381 _message.so`google::protobuf::python::cmessage::GetAttr(self=0x000000010548ac80, name=0x000000010291db48) + 65 at message.cc:2695
   2692	    return value;
   2693	  }
   2694	
-> 2695	  const FieldDescriptor* field_descriptor = GetFieldDescriptor(self, name);
   2696	  if (field_descriptor == NULL) {
   2697	    return CMessage_Type.tp_base->tp_getattro(
   2698	        reinterpret_cast<PyObject*>(self), name);
@wilstoff
Copy link

wilstoff commented Mar 3, 2017

I am also getting this exact segfault when running tests on our custom objects. I'm running v3.0.2, and we run our python tests with nosetests. Any idea what is going on?

@anandolee
Copy link
Contributor

Can you give more trace information and which line of testMergeFrom() fail? I am unable to reproduce the segfault. Does all other tests always pass if comments out testMergeFrom()?

@anandolee
Copy link
Contributor

I am closing this for clean up and unable to reproduce. Feel free to reopen if anyone can provide more detail of the failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants