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

[CT-48] [Bug] Logger throws recursion errors because of Deprecation Warnings #4576

Closed
1 task done
senickel opened this issue Jan 17, 2022 · 2 comments
Closed
1 task done
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@senickel
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

dbt debug shows that everything is green. Then I run
When running dbt run (or seed or deps) I get a recursion error (see output section).

Solution:
When I did some low key investigation it seems that this is triggered by deprecation warnings. I then took the liberty to add the line

warnings.filterwarnings("ignore", category=DeprecationWarning) 

to dbt/logger.py and now it works. (Not sure if this is the best solution though)

Expected Behavior

It should not get the recursion error.

Steps To Reproduce

git clone [email protected]:dbt-labs/jaffle_shop.git
cd jaffle_shop
pyenv local 3.10.1
python -m venv .venv
source .venv/bin/activate
pip install dbt-postgres
dbt run

Relevant log output

Traceback (most recent call last):
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/handlers.py", line 216, in handle
    self.emit(record)
  File "jaffle_shop/.venv/lib/python3.10/site-packages/dbt/logger.py", line 467, in emit
    super().emit(record)
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/handlers.py", line 836, in emit
    msg = self.format(record)
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/dbt/logger.py", line 454, in format
    msg = super().format(record)
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/handlers.py", line 195, in format
    return self.formatter(record, self)
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/handlers.py", line 387, in __call__
    line = self.format_record(record, handler)
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/handlers.py", line 371, in format_record
    return self._formatter.format(record=record, handler=handler)
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/helpers.py", line 283, in __get__
    value = self.func(obj)
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/base.py", line 675, in thread_name
    return thread_get_name()
  File "/jaffle_shop/.venv/lib/python3.10/site-packages/logbook/concurrency.py", line 141, in thread_get_name
    return currentThread().getName()
  File "/home/xx/.pyenv/versions/3.10.1/lib/python3.10/threading.py", line 1442, in currentThread
    warnings.warn('currentThread() is deprecated, use current_thread() instead',
RecursionError: maximum recursion depth exceeded


### Environment

```markdown
- OS: Ubuntu 20.04
- Python:3.10.1
- dbt: 1.0.1

What database are you using dbt with?

postgres

Additional Context

No response

@senickel senickel added bug Something isn't working triage labels Jan 17, 2022
@github-actions github-actions bot changed the title [Bug] Logger throws recursion errors because of Deprecation Warnings [CT-48] [Bug] Logger throws recursion errors because of Deprecation Warnings Jan 17, 2022
@senickel
Copy link
Author

When I do the same for https://github.com/mjirv/dbt-datamocktool it works without problems. However, when I repeat it for jaffle_shop it fails. Maybe this is an issue just on my side or with the jaffle_shop repo?

@jtcohen6
Copy link
Contributor

Hey @senickel, thanks for the detailed write-up!

I believe this is a duplicate of #4537. dbt v1.0 does not officially support Python 3.10; we're looking to add support for it in v1.1 (#4562), which will require (at minimum) addressing the flood of deprecation warnings related to the legacy logger / logbook.

Until then, the official resolution will be to downgrade your Python version to 3.9 while using dbt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants