question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Boto3 causing segmentation fault

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
kmurphy4commented, Oct 7, 2019

FYI, this works for me in python 3.6.8, but not in python 3.7.3. Maybe this is worth reporting to python?

4reactions
anuj9196commented, Nov 19, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation fault while Importing python module to a Python ...
And when I add import boto3 in this script, crash is observed. import boto3 def test(BucketName, ObjectName, Data ): return "Bucketname: " ...
Read more >
int(s), float(s) and others may cause segmentation fault
Running with `-X faulthandler` Fatal Python error: Segmentation fault Current thread 0x00007fff89cf2380 (most recent call first): File ...
Read more >
DynamoDB — Boto3 Docs 1.26.34 documentation - AWS
Error details for individual statements can be found under the Error ... Causes DynamoDB to evaluate the value before attempting a conditional operation:....
Read more >
Error handling — Boto3 Docs 1.26.32 documentation - AWS
How to catch and handle exceptions thrown by both Boto3 and AWS services; How to parse error responses from AWS services. Why catch...
Read more >
SNS — Boto3 Docs 1.26.34 documentation - AWS
If set to Active, Amazon SNS will vend X-Ray segment data to topic owner ... Failure to parse or validate any key or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found