Skip to content

VCR hijacks contextmanager cleanup in urllib3. Doesn't cleanup conn to pool correctly (exchangelib) #949

Description

@Siponek

Hello there :)

tldr;
I am using exchangelib that lazly evaluates queries. Underneath the hood it uses urllib3 , when performing calls and recording them via VCR the test hangs, because it cannot clean up the connection. Everything works when not recording via VCR.


I have added several print_traceback() and and made logs working (no-vcr) and non-working VCR version. The problem is that when the request by exchangelib/urllib3 is being made then in normal scenario the libs are putting back connection after the request/connection was made. When this is recorded by VCR, the connection is not being put down in normal fashion, but out of order and also during teardown.

So the question is how to make VCR not meddle with context manager in other libs or at least make it mimic the context manager so that the other libs can close up conns when needed?


Please ask questions so I can awnser to the best of my ability :)
I did my best to obfuscate any sensitive data, but let me know.

Attaching logs.

no-vcr.log

vcr-recorded.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions