Skip to content

Handle RecursionError exception in perform_request #1609

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

Merged
merged 2 commits into from
Jun 7, 2021

Conversation

hmilkovi
Copy link
Contributor

@hmilkovi hmilkovi commented Jun 6, 2021

Propagate RecursionError if it happends on lower levels so when used like:

import sys
import inspect
import elasticsearch

es_client = elasticsearch.Elasticsearch("http://localhost:9200/")
print(f"Recursion limit: {sys.getrecursionlimit()}")

def rec():
    print(len(inspect.stack()))
    es_client.index(index='testing', body={'test': 'test'}, request_timeout=1)
    rec()

rec()

So it doesn't crash python interpreter with core dump and raises as expected RecursionError.

Related issue: #1602

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@sethmlarson sethmlarson merged commit cfdfd51 into elastic:master Jun 7, 2021
@sethmlarson
Copy link
Contributor

Thanks much!!

@hmilkovi hmilkovi deleted the fix_recursion_handling branch June 7, 2021 17:51
@hmilkovi hmilkovi restored the fix_recursion_handling branch June 7, 2021 17:51
@hmilkovi hmilkovi deleted the fix_recursion_handling branch June 9, 2021 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants