-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
Cold (?) starting curl_cffi session with ThreadPoolExecutor crashes silently #422
Comments
Do you mean that the second time you run the script, it works? It's really weird that a exited process would have effect on a non-related second process. |
Yes, that's what I mean. I agree this is definitely weird. But it only happens after I switched to use |
A small correction: it's not always the very first session.get(). As shown in newly added console output example, it fails after 3 threads finished successfully.
|
Sorry, I tried a few times on my MacBook, but I can not reproduce it. Could you please share a script that is more reliable to reproduce this? |
Unfortunately, I don't find a more reliable way to reproduce it either. I still encounter it from time to time. Any clue why it never throws any error, though? I think if we can get some error messages, it would be very helpful to find the root cause of it. |
You can set |
I managed to create an output file using I’ve masked all the Thanks! |
Sorry, but I don’t see any problem-causing log here. |
Please check the following items before reporting a bug, otherwise it may be closed immediately.
UNLESS it has been verified that the reason is missing pieces in the impersonation.
Describe the bug
When using
concurrent.futures.ThreadPoolExecutor
to run multiple threads with the sameimpersonate='chrome'
session (fromrequests_curl.Session(impersonate='chrome')
), the script often crashes during the first fewsession.get()
calls. However, no exception is raised when this happens.The bug is difficult to reproduce consistently, but I find a pattern:
If the script hasn't been run for a long period (e.g., 10 hours), it always crashes the first time it's executed afterward (same computer, no restarts).
After that initial crash, any subsequent runs work fine without issues.
To Reproduce
My script is similar to the one below:
Expected behavior
It should run without issue.
Observed:
Versions
pip freeze
dump dump.txtAdditional context
requests
,httpx
or real browsers. have never seen similar crash before.The text was updated successfully, but these errors were encountered: