Skip to content

[python] Protobuf 4.21.0 - Seg fault on instantiation by repeated field assignment #10063

Closed
@dwsutherland

Description

@dwsutherland

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..

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions