Skip to content
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

Elusive TLS Windows issue with binary data (png files) #9692

Closed
trgwii opened this issue Mar 5, 2021 · 2 comments · Fixed by #10146
Closed

Elusive TLS Windows issue with binary data (png files) #9692

trgwii opened this issue Mar 5, 2021 · 2 comments · Fixed by #10146

Comments

@trgwii
Copy link
Contributor

trgwii commented Mar 5, 2021

Okay, this is a very strange issue, so I'm not very sure where to put this. Let's say I have this Deno HTTPS server:

import { serveTLS } from "https://deno.land/[email protected]/http/server.ts";

const server = serveTLS({
  port: 443,
  hostname: "0.0.0.0",
  certFile: "cert/fullchain.pem",
  keyFile: "cert/key.pem",
});

for await (const req of server) {
  (async () => {
    const file = await Deno.open("image.png");
    await req.respond({
      headers: new Headers({
        "Content-Type": "image/png",
      }),
      body: file,
    });
    await req.done;
    file.close();
  })();
}

Using the following image file:
image

I'm on Windows 10.0.19042.804.

(Edit) Deno version:

deno 1.8.0 (release, x86_64-pc-windows-msvc)
v8 9.0.257.3
typescript 4.2.2

On Windows, when I request this server from a browser or curl, it seems to only load the first 64KiB and then hang the request:
2021-03-05_11-04-11

If I run the same program in Deno in WSL (1) it works completely fine.

Also if I try to set the file to a 2.5MB JS file, it loads the entire file fine on Windows too, and doesn't hang the request, so there seems to be something that ONLY fails for Windows + binary files going on here.

Am I doing something wrong in my code?

@kt3k
Copy link
Member

kt3k commented Mar 30, 2021

probably related to denoland/std#750. Can you reproduce this issue with v1.7.0? (you can downgrade deno by the command deno upgrade --version 1.7.0

piscisaureus added a commit to piscisaureus/deno that referenced this issue May 10, 2021
…ite half"

using tokio::io::split() to allow concurrent Conn#read() and
Conn#write() calls without one blocking the other. However, this
introduced a bug: outgoing data gets discarded when the TLS stream is
gracefully closed, because the read half is closed too early, before all
TLS control data has been received.

Fixes: denoland#9692
Fixes: denoland#10049
Fixes: denoland#10296
Fixes: denoland/std#750
piscisaureus added a commit to piscisaureus/deno that referenced this issue May 10, 2021
denoland#10146)

In denoland#9118, TLS streams were split into a "read half" and a "write half"
using tokio::io::split() to allow concurrent Conn#read() and
Conn#write() calls without one blocking the other. However, this
introduced a bug: outgoing data gets discarded when the TLS stream is
gracefully closed, because the read half is closed too early, before all
TLS control data has been received.

Fixes: denoland#9692
Fixes: denoland#10049
Fixes: denoland#10296
Fixes: denoland/std#750
@ry
Copy link
Member

ry commented May 11, 2021

Reopening. Fix revert in #10595. False alarm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants