deno: dialTLS Conn.read() stops resolving after writing to connection from promise resolution
When using dialTLS, Conn.read() will stop resolving if you write to the connection from a promise resolution if the promise is not immediately resolved.
Repro code
Expected output:
Sending req #1 (normal)
Response!
Sending req #2 (Immediate promise resolution)
Resolved! (sending)
Response!
Sending req #3 (Delayed promise resolution)
Resolved! (sending)
Response!
All responses recieved correctly, exiting.
Actual output:
Sending req #1 (normal)
Response!
Sending req #2 (Immediate promise resolution)
Resolved! (sending)
Response!
Sending req #3 (Delayed promise resolution)
Resolved! (sending)
No response after 8 seconds, exiting.
If you change the code to use Deno.dial and port 80 you get the expected output, so the issue is unique to dialTLS.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (19 by maintainers)
Don’t worry about it, when this issue first appeared in my code I spent quite a while trying to figure out if it was a bug in my code, and not a Deno issue. And as you can see, I still didn’t have the exact nature of the issue nailed down until after you forced me to examine my assumption by adding some awaits in.
The issue is with writing from within a Promise resolution, so of course awaiting said promise will avoid the issue…