Message296531
No one yet responded, maybe this is unclear. I will clarify what is going on, why i made this change, what we gain from this and why this is not ideal solution.
I will focus on ssl layer shutdown as this issue regards.
We have connection asyncio <-> nginx
Lets see first situation asyncio initiates shutdown:
1. ideal:
shutdown
asyncio ----------> nginx
<----------
shutdown
Ideal situation asyncio sending shutdown and nginx replies back. This is how it works before attached PR.
2. we can't relay on nginx
shutdown
asyncio ----------> nginx
|||||||||||
shutdown
At this point everything looks great, but what will happen when nginx do not sent shutdown - we will wait forever.
We have this situation here #29406.
Attached PR "fix" this problem (note is not ideal fix, more like workaround):
3. with fix:
shutdown
asyncio ----------> nginx
||?--------
shutdown
asyncio is sending shutdown ssl data to nginx but not waiting for nginx response, transport is closed anyway. I think ideal will
be to wait for certain amount of time for response like Nikolay in #29406 propose. This will allow to implement SSL downgrade to
plain text.
Second situation, nginx sent ssl eof.
1. before fix:
shutdown
nginx ----------> asyncio
|||||||||||
shutdown
In this case we are receiving nginx shutdown and correctly process it but after that, shutdown callback will close the transport before
shutdown is sent back. Asyncio will try to send this data but fail due to closed transport. There is another issue should be not possible
to write to closed transport. We are getting false-positive result to write. I do not analyze this deeper,
maybe there is a reason to it.
2. after fix:
shutdown
nginx ----------> asyncio
<----------
shutdown
This is clean, shutdown callback in _SSLPipe is removed. We close transport in ssl protocol.
I think connections between _SSLPipe and ssl protocol has design problems, _SSLPipe should be, as name suggest, only a pipe.
Callback for handshake and shutdown feels wrong. Ssl protocol based on _SSLPipie mode and state can figure out when to call
connection_made or close transport. |
|
Date |
User |
Action |
Args |
2017-06-21 09:17:37 | grzgrzgrz3 | set | recipients:
+ grzgrzgrz3, yselivanov, thehesiod |
2017-06-21 09:17:37 | grzgrzgrz3 | set | messageid: <1498036657.43.0.785306503628.issue30698@psf.upfronthosting.co.za> |
2017-06-21 09:17:37 | grzgrzgrz3 | link | issue30698 messages |
2017-06-21 09:17:37 | grzgrzgrz3 | create | |
|