profile
viewpoint

Ask questionsInsight required: Resource (TCP) errors

Please ignore - I hadn't accounted for the fact that multiple errors may be emitted.

Currently, when a Deno TCP socket has an error, I attempt to call .close() on the Deno.Conn instance.

If it was a read error, everything works as expected (resource exists) If it was a write error, I get an error that there is no such resource (resource doesn't exist)

I'm wondering is this universal - will different types of read errors cause the resource to be removed, or will some types of write errors not remove the resource?

Why does this happen? is it to do with half open sockets? is it a bug?

At present, I am checking the value of Deno.resources()[rid] before closing. Hopefully that will get me by for now.

denoland/deno

Answer questions realJoshByrnes

I wrote this test (overkill) and discovered that it's not actually the issue I expected. The error was because Deno can emit multiple errors, and I am closing on error - duh!

Ironically, in every test I've done the read error happens first, followed by the write (the second .close() was causing the error - correctly)

Sorry about that.

useful!

Related questions

{WSL 2} Permission denied (os error 13) hot 1
gRPC in Deno? hot 1
deno remove/uninstall subcommand hot 1
TCP accept loop doesn't use for-await hot 1
Support d.ts files hot 1
Restore runtime lib generation capability hot 1
disable flaky tests _048_media_types_jsx and _019_media_types hot 1
Typescript Custom Transformers Support hot 1
reorg directory structure hot 1
Centos 7 GLIBC_2.18 not found hot 1
"deno ast script.ts" hot 1
Text decoding performance abysmally slow. hot 1
"deno ast script.ts" hot 1
Can't build master hot 1
Can't build master hot 1
Github User Rank List