-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Upgrading connection to TLS panicks #13345
Comments
Do you have a reproduction? |
Not yet, I'll try to look at it in 5. |
Ok so the sample below works in 1.16.4 but not 1.17.x when trying to connect to my local Postgres server. It's not giving me the panic as above though, but rather the error below. I'll try my project that gave the panic with 1.16 now.
Code: Deno.connect({ transport: 'tcp', port: 5432, hostname: 'localhost' }).then(async conn => {
conn.write(new Uint8Array([0, 0, 0, 8, 4, 210, 22, 47]))
const b = new Uint8Array(128)
while (await conn.read(b)) {
if (b[0] === 83) {
Deno.startTls(conn, { hostname: 'localhost' }).then(connected)
break
}
}
})
async function connected(conn) {
const b = new Uint8Array(128)
while (await conn.read(b))
console.log(b)
} |
Hmm.. also getting the panic on 1.16.4 in my project. I'll look closer tomorrow.. |
What if you add 'await' before the 'conn.write' call? |
No difference |
I think the error I'm getting with 1.17.x in the code above is related to #10312 so I won't open a new issue for that. With regards to the panic I'm still no wiser why I can make a simple repro of it, and why it fails like that in my project. |
finally 😅 Here is a reproducible code sample trying to startTls Deno.connect({ transport: 'tcp', port: 5432, hostname: 'localhost' }).then(async conn => {
await conn.write(new Uint8Array([0, 0, 0, 8, 4, 210, 22, 47]))
const b = new Uint8Array(128)
while (await conn.read(b)) {
if (b[0] === 83) {
connect(conn)
// adding break here fixes the issue
}
}
})
async function connect(conn) {
await 0 // This is the reason it panicks, and if I remove it I get a more descriptive BadResource: Bad resource ID error
Deno.startTls(conn, { hostname: 'localhost' })
} It's run with |
Deno should not crash (that's a bug, it should always fail with BadResource), but I'd like to point out that this causes startTls() to run concurrently with read(). It makes no sense to do that. |
Yeah, that also makes sense, but I expected read to end once startTls was called which was why I didn't think I'd need to handle that explicitly. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This still happens with 1.19.3 |
Happening under slightly different conditions in #13926, but the same underlying issue. |
…original connection is captured elsewhere (#16242) This commit removes the calls to `expect()` on `std::rc::Rc`, which caused Deno to panic under certain situations. We now return an error if `Rc` is referenced by other variables. Fixes #9360 Fixes #13345 Fixes #13926 Fixes #16241 Co-authored-by: Bartek Iwańczuk <[email protected]>
I don't know if closed issues are followed, so I'm creating this issue which relates to #9360
I'm experiencing the same as that issue with 1.17.2.
It's happening on my Macbook M1. Here's the complete log:
The text was updated successfully, but these errors were encountered: