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
TraceConfig signals not triggered #3764
Comments
This is full code that recreates the above described behaviour.
|
Briefly looking on your snippet I guess that you have the following situation:
Does it look real? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Long story short
I am using TraceConfig signals to synchronise POST requests. They have to be send out in particular order, and since the process is timing critical, I am waiting for event (Event.wait) in on_connection_create_end. The event is released/triggered in on_request_chunk_sent with Event.set.
The code is like this:
I am running two batches of 5 requests.
make_post_req creates POST request using the session object.
tr_events is a global variable to track asyncio.Event objects between requests. I.e. request 1 has to wait for release of request 0.
The idea is to create almost 5 requests in parallel; but the later request is only released after the previous request has already sent out the payload.
Expected behaviour
I would expect that first and the second batch are processed equally which is not the case.
Actual behaviour
The first batch (the firs run of loop i) is processed correctly. All signals are triggered.
On the second batch only signals on_request_start, on_request_chunk_sent and on_request_end are triggered. Since the on_connection_create_end is not triggered my locks are not awaited.
print(trace_config.on_connection_create_end[0]) is there to verify whether TraceConfig object holds a valid reference to the function.
I have also removed the i loop and made two sequential batches of 5 requests. The same behaviour.
I am tracking the following signals:
trace_config.on_request_start.append(on_request_start) trace_config.on_request_end.append(on_request_end) trace_config.on_connection_create_start.append(on_connection_create_start) trace_config.on_dns_cache_hit.append(on_dns_cache_hit) trace_config.on_dns_resolvehost_end.append(on_dns_resolvehost_end) trace_config.on_connection_create_end.append(on_connection_create_end) trace_config.on_request_chunk_sent.append(on_request_chunk_sent)
How come that the signals are not triggered in the second run?
Your environment
client
The text was updated successfully, but these errors were encountered: