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] Protobuf 4.21.0 - Seg fault on instantiation by repeated field assignment #10063

Closed
dwsutherland opened this issue May 27, 2022 · 3 comments
Assignees
Labels

Comments

@dwsutherland
Copy link

dwsutherland commented May 27, 2022

What version of protobuf and what language are you using?
Version: v4.21.0
Language: Python

What operating system (Linux, Windows, ...) and version?
Linux, Ubuntu 20.04.4 LTS, 64-bit

What runtime / compiler are you using (e.g., python version or gcc version)

Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux

What did you do?
Using the following message case:

message PbTestNode {
    optional PbTestEdges edges = 1;
}

message PbTestEdges {
    optional string id = 1;
    repeated string leaves = 2;
}

When running with protobuf==4.21.0 (and our code generated to match) I come across this:

Successfully installed cylc-flow-8.0rc4.dev0 protobuf-4.21.0
(flow) sutherlander@graphic-vbox:cylc-flow$ python
Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.protobuf.internal import api_implementation
>>> print(api_implementation.Type())
upb
>>> from cylc.flow.data_messages_pb2 import PbTestNode
>>> n1 = PbTestNode()
>>> n1.edges.id = 'flint'
>>> n1.edges.leaves[:] = ['one', 'two', 'three']
>>> n2 = PbTestNode()
>>> n2.edges.leaves[:] = ['one', 'two', 'three']
Segmentation fault (core dumped)

So it only happens on field instantiation, and using the list assignment:

Successfully installed cylc-flow-8.0rc4.dev0 protobuf-4.21.0
(flow) sutherlander@graphic-vbox:cylc-flow$ python
Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.protobuf.internal import api_implementation
>>> print(api_implementation.Type())
upb
>>> from cylc.flow.data_messages_pb2 import PbTestNode
>>> n4 = PbTestNode()
>>> n4.edges.leaves.extend(['one', 'two', 'three'])
>>> n4.edges.leaves[:] = []
>>> n4.edges.leaves[:] = ['one', 'two', 'three']
>>> n4.edges.leaves
['one', 'two', 'three']
>>> exit()

What did you expect to see
The previous version works:

Successfully installed cylc-flow-8.0rc4.dev0 protobuf-3.20.1
(flow) sutherlander@graphic-vbox:cylc-flow$ python
Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.protobuf.internal import api_implementation
>>> print(api_implementation.Type())
cpp
>>> from cylc.flow.data_messages_pb2 import PbTestNode
>>> n3 = PbTestNode()
>>> n3.edges.leaves[:] = ['one', 'two', 'three']
>>> exit()

What did you see instead?

Segmentation fault (core dumped)

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment
The pip installation had this warning (about it's procurement):

WARNING: The candidate selected for download or install is a yanked version: 'protobuf' candidate (version 4.21.0 at https://files.pythonhosted.org/packages/9d/82/b3131637daf2a27eab76b0de8e139ecf0f6624832c03531dce8a7d59ddc1/protobuf-4.21.0-cp37-abi3-manylinux2014_x86_64.whl#sha256=9a65e012bc06022e98a57165ea48438b3b9f652eee33db7cbecb883588f9f169 (from https://pypi.org/simple/protobuf/))
Reason for being yanked: Compatibility issue with cloud client libraries

but, probably safe to assume it's unrelated..

@dwsutherland
Copy link
Author

Brilliant, thanks for the quick response:

Successfully installed cylc-flow-8.0rc4.dev0 protobuf-4.21.1
(flow) sutherlander@graphic-vbox:cylc-flow$ python
Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.protobuf.internal import api_implementation
>>> print(api_implementation.Type())
upb
>>> from cylc.flow.data_messages_pb2 import PbTestNode
>>> n4 = PbTestNode()
>>> n4.edges.leaves[:] = ['one', 'two', 'three']
>>> n4
edges {
  leaves: "one"
  leaves: "two"
  leaves: "three"
}

🎉

@dado0583
Copy link

@dwsutherland - I'm getting same issue on python 3.11 and protobuf-4.21.1. Did you do anything specific to fix?

@dwsutherland
Copy link
Author

@dwsutherland - I'm getting same issue on python 3.11 and protobuf-4.21.1. Did you do anything specific to fix?

Sorry for the late reply... nothing specific, the fix implemented solved the problem for me.

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

No branches or pull requests

3 participants