getappmap / getappmap/appmap-python

The agent keeps a reference to an instrumented function that prevents it from being garbage collected

Đang mở
#317 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@apotterri đang làm issue này rồi.

Từ ngày 24/5/2024.

bug
Ngôn ngữ chính
Python
Star
104
Fork
17
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

https://github.com/pallets/flask

============================================================== FAILURES ==============================================================
__________________________________________________ test_app_freed_on_zero_refcount ___________________________________________________

    @require_cpython_gc
    def test_app_freed_on_zero_refcount():
        # A Flask instance should not create a reference cycle that prevents CPython
        # from freeing it when all external references to it are released (see #3761).
        gc.disable()
        try:
            app = flask.Flask(__name__)
            assert app.view_functions["static"]
            weak = weakref.ref(app)
            assert weak() is not None
            del app
>           assert weak() is None
E           AssertionError: assert <Flask 'test_basic'> is None
E            +  where <Flask 'test_basic'> = <weakref at 0x11b897b50; to 'Flask' at 0x11bcc5150>()

tests/test_basic.py:1888: AssertionError
--------------------------------------------------------- Captured log call ----------------------------------------------------------
INFO     _appmap.recording:recording.py:77 writing /Users/kgilpin/source/land-of-apps/pallets-flask/tmp/appmap/pytest/test_app_freed_on_zero_refcount.appmap.json
========================================================== warnings summary ==========================================================
venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:274
  /Users/kgilpin/source/land-of-apps/pallets-flask/venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:274: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: _appmap
    self.config.issue_config_time_warning(

venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:274
  /Users/kgilpin/source/land-of-apps/pallets-flask/venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:274: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: appmap
    self.config.issue_config_time_warning(

tests/test_basic.py::test_server_name_subdomain
  /Users/kgilpin/source/land-of-apps/pallets-flask/venv/lib/python3.10/site-packages/_appmap/instrument.py:92: UserWarning: Current server name 'foo.localhost' doesn't match configured server name 'dev.local'
    ret = f.fn(*args, **kwargs)

tests/test_basic.py::test_subdomain_matching_other_name[False]
tests/test_basic.py::test_subdomain_matching_other_name[True]
  /Users/kgilpin/source/land-of-apps/pallets-flask/venv/lib/python3.10/site-packages/_appmap/instrument.py:92: UserWarning: Current server name '127.0.0.1:3000' doesn't match configured server name 'localhost.localdomain:3000'
    ret = f.fn(*args, **kwargs)

tests/test_reqctx.py::test_proper_test_request_context
  /Users/kgilpin/source/land-of-apps/pallets-flask/venv/lib/python3.10/site-packages/_appmap/instrument.py:92: UserWarning: Current server name 'localhost' doesn't match configured server name 'localhost.localdomain:5000'
    ret = f.fn(*args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
====================================================== short test summary info =======================================================
FAILED tests/test_basic.py::test_app_freed_on_zero_refcount - AssertionError: assert <Flask 'test_basic'> is None
================================== 1 failed, 469 passed, 7 skipped, 6 warnings in 85.70s (0:01:25) ===================================

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.