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

RecursionError: maximum recursion depth exceeded while calling a Python object #539

Closed
ryou90 opened this issue Mar 9, 2023 · 1 comment · Fixed by #540
Closed

RecursionError: maximum recursion depth exceeded while calling a Python object #539

ryou90 opened this issue Mar 9, 2023 · 1 comment · Fixed by #540
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@ryou90
Copy link
Contributor

ryou90 commented Mar 9, 2023

Expected Behavior

I want to retrieve an env variable from the dapr.config.settings class. If the variable is not present, an attribute error should be issued.

E.g.

from dapr.conf import settings

x = settings.APP_PORT # Not exist -> throw recursion error

Actual Behavior

When the variable not exists, a maximum recursion error is thrown and not a attribute error. This happens because the settings class use getattr method to lookup for non existing env variables. Within the method, getattr(..) is called, which caused a new recursive call.

The problem can be easily solved by removing the getattr method.

Steps to Reproduce the Problem

Test example code.

Release Note

RELEASE NOTE:
Fix RecursionError when calling non-existing env variable from settings class

@berndverst
Copy link
Member

berndverst commented May 3, 2023

APP_PORT is not a supported setting in this SDK. There is HTTP_APP_PORT and GRPC_APP_PORT.

See

HTTP_APP_PORT = 3000
GRPC_APP_PORT = 3010
DAPR_API_TOKEN = None
DAPR_RUNTIME_HOST = '127.0.0.1'
DAPR_HTTP_PORT = 3500
DAPR_GRPC_PORT = 50001
DAPR_API_VERSION = 'v1.0'
DAPR_API_METHOD_INVOCATION_PROTOCOL = 'http'
DAPR_HTTP_TIMEOUT_SECONDS = 60

I updated the open PR for this issue to instead throw an AttributeError whenever you try to access a property that is not implemented.

EDIT: Your issue was filed correctly - I got confused because I looked at the PR that was opened first (thought it was from you, but was from someone else). The updates I made to that PR should give you exactly what you want -- an AttributeError for properties that don't exist / are not supported.

@berndverst berndverst added this to the v1.10 milestone May 30, 2023
@berndverst berndverst self-assigned this Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants