boto3: Boto3 causing segmentation fault
In some special circumstance, using boto3 will cause segmentation fault.
The code that can reproduce it is as follows. There are totally 3 files (and one subdirectory) need to be created because I am not able to reproduce it with only one file. You can also clone from https://github.com/JasonXJ/segmentation_fault_with_boto3
./mypackage/__init__.py:
import sys
import boto3
def foo():
bar(boto3.resource('dynamodb', region_name='us-east-2'))
sys.exit(0) # Unable to reproduce without this line
# Unable to reproduce if merge this function with foo()
def bar(dynamodb):
import mypackage.justtyping # Unable to reproduce without this line
# Unable to reproduce if do not get item twice, or use `dynamodb` in both
# cases, or create new resource in both cases.
# Note that the table must exist, but it does not need to have the item.
dynamodb.Table('sigsegv').get_item(Key={'pkey': 'xxx'})
boto3.resource('dynamodb', region_name='us-east-2').Table('sigsegv').get_item(Key={'pkey': 'xxx'})
./mypackage/justtyping.py
from typing import Sequence
x = Sequence['xxx'] # Unable to reproduce without this line, or replace string `'xxx'` with a class (e.g. `bytes`)
./run.py
import mypackage
mypackage.foo()
Run the code and get the segmentation fault:
$ python3 run.py
[1] 26495 segmentation fault (core dumped) python3 run.py
FAIL
Versions: python 3.5.2, boto3 1.4.4, ubuntu 16.04.2
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 15 (5 by maintainers)
FYI, this works for me in python 3.6.8, but not in python 3.7.3. Maybe this is worth reporting to python?
I’m also facing this issue. I’m using django-storages and files are being created in the S3 but while reading the file, it gives Segmentation fault (core dumped) error.