Coder Social home page Coder Social logo

Comments (44)

dandradesg avatar dandradesg commented on May 3, 2024 6

npm cache clean --force

from compress.

rimiti avatar rimiti commented on May 3, 2024 4

In my case, after making a npm cache clean --force, everything works again.

from compress.

mcollina avatar mcollina commented on May 3, 2024 3

Confirmed, this is still happening. Quite interestly enough, this does not happen with CURL. I'll see if I can track this down (it might take a while).

It seems a different one than nodejs/node#13850.

from compress.

Eldar-X avatar Eldar-X commented on May 3, 2024 2

In my case, i found solution by changing order of compress and conditional-get middleware

    app.use(compress({
      flush: require('zlib').Z_SYNC_FLUSH
    }))
    .use(conditional())
    .use(etag())

from compress.

pastelsky avatar pastelsky commented on May 3, 2024 2

Still experiencing this in 8.1.2. I don't have conditional-get middleware.

from compress.

Eldar-X avatar Eldar-X commented on May 3, 2024 2

node v8.1.3 still same issue

const app = new Koa();

const conditional = require('koa-conditional-get');
const etag = require('koa-etag');
const compress = require('koa-compress');
const serveStatic = require('koa-static');

app.use(conditional())
app.use(etag())
app.use(compress())
app.use(serveStatic('public'))

app.use(async(ctx, next) => {
  ctx.type = 'text/html';
  ctx.body = `<!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="/test.css">
  </head>
  <body>
  Response OK
  </body>
  </html>`;
})

app.listen(3000)

Don't forget to include test css with some content to public dir

from compress.

mcollina avatar mcollina commented on May 3, 2024 2

Here is the fix: nodejs/node#14330

from compress.

mcollina avatar mcollina commented on May 3, 2024 1

Can you check if nodejs/node#13850 this solves the issue?

from compress.

mrchief avatar mrchief commented on May 3, 2024 1

I don't use conditional get or etag and still see this issue (with node 8.1.3 and even using Z_SYNC_FLUSH). I'm using koa-webpack middleware though.

from compress.

mcollina avatar mcollina commented on May 3, 2024 1

This should be definitely fixed in Node 8.2.1.

from compress.

tuananh avatar tuananh commented on May 3, 2024

Confirmed. I get this issue with Node v8 as well.

from compress.

tuananh avatar tuananh commented on May 3, 2024

Anyone taking this? Can someone point me to where I should look?

from compress.

tuananh avatar tuananh commented on May 3, 2024

Notice node 8.1 fixes something in zlib. Is this related?

A regression in the Zlib module that made it impossible to properly subclasses zlib.Deflate and other Zlib classes has been fixed. [6aeb555cc4] #13374.

from compress.

andykant avatar andykant commented on May 3, 2024

This still occurs in Node v8.1.0.

from compress.

niftylettuce avatar niftylettuce commented on May 3, 2024

Same issue, v8.0.0

from compress.

tuananh avatar tuananh commented on May 3, 2024

@jonathanong could you please take a look?

from compress.

jonathanong avatar jonathanong commented on May 3, 2024

i've seen this before. i haven't investigated it yet. it is one of the blockers for me to upgrading to node 8.

from compress.

tuananh avatar tuananh commented on May 3, 2024

anyone found a fix for this? also, is there an alternative middleware?

from compress.

jonathanong avatar jonathanong commented on May 3, 2024

is it because you are using Z_SYNC_FLUSH? what happens if you don't use a flush parameter?

from compress.

jonathanong avatar jonathanong commented on May 3, 2024

e50d15f seems okay to me.

anyone else have any ideas?

from compress.

Eldar-X avatar Eldar-X commented on May 3, 2024

@jonathanong without flush parameter i have same result but if koa-compress middleware over conditional-get middleware everything okay. Looks like this issue happening only when we use conditional-get middleware.

from compress.

jonathanong avatar jonathanong commented on May 3, 2024

okay, i think the time i saw this error was with v8.0.0. i don't see it anymore with the latest node

from compress.

tuananh avatar tuananh commented on May 3, 2024

It seems 8.1.2 fixes it. Any idea what causes this in the first place?

from compress.

Eldar-X avatar Eldar-X commented on May 3, 2024

I have same issue in 8.1.2 but with conditional-get middleware. I see this issue once more when my stream was broken.

from compress.

jonathanong avatar jonathanong commented on May 3, 2024

can anyone make a PR with a failing test casE?

from compress.

andykant avatar andykant commented on May 3, 2024

Node 8.1.3 fixes the issue.

from compress.

tuananh avatar tuananh commented on May 3, 2024

8.1.3 works for me as well

from compress.

jonathanong avatar jonathanong commented on May 3, 2024

closing. thanks @mcollina !

from compress.

mcollina avatar mcollina commented on May 3, 2024

I'll be happy to have a look, if you can post an example to reproduce the issue consistently.

from compress.

Eldar-X avatar Eldar-X commented on May 3, 2024

@mcollina you can try my example only install deps and run this app then visit page and reload it! After reloading you can see this message in your console

  1. I am using Marko.js and i streaming response to ctx.body but if i have error in my template file i also see this error message.

from compress.

mrchief avatar mrchief commented on May 3, 2024

@mcollina My setup is bit complicated but @Eldar-X setup will do.

from compress.

mcollina avatar mcollina commented on May 3, 2024

@Eldar-X @mrchief I cannot reproduce with node 8.1.2, 8.1.3, 8.1.4 or master using your example on Mac OS X 10.11 and Chrome.

from compress.

mrchief avatar mrchief commented on May 3, 2024

Could the OS be a factor? I'm on Windows 7 x64. Even in my setup, I don't get it consistently. E.g., I ran my app right now and there were no errors. Then I refreshed the page and saw this error. And sometimes it happens many times within the same request.

I'll try to upload my setup tonight.

from compress.

Eldar-X avatar Eldar-X commented on May 3, 2024

@mcollina i am also on Mac Os 10.11

tem-13-2017 20-17-07

from compress.

Eldar-X avatar Eldar-X commented on May 3, 2024

https://github.com/Eldar-X/koa-issue my simple setup

from compress.

mcollina avatar mcollina commented on May 3, 2024

Now I cannot reproduce anymore. However, the same node version/code was showing the problem while I was traveling (and I could not work on it). If someone has a consistent way of reproducing this problem, please let me know.

from compress.

mcollina avatar mcollina commented on May 3, 2024

I can reproduce by loading the server with autocannon:

autocannon -H Accept-Encoding=gzip -c 100 -d 5 localhost:3000

from compress.

refack avatar refack commented on May 3, 2024

Will you be adding a regression test for this? Then maybe apply for addition to node's CitGM

from compress.

refack avatar refack commented on May 3, 2024

@jonathanong if you could write a regression test for this. It's literally keeping up at night 😨

from compress.

jonathanong avatar jonathanong commented on May 3, 2024

@refack im not sure what the test case is...

from compress.

refack avatar refack commented on May 3, 2024

@jonathanong this might help https://github.com/nodejs/node/pull/14330/files 🤷‍♂️

from compress.

sekoyo avatar sekoyo commented on May 3, 2024

I have it on 8.10.0 on windows

from compress.

mcollina avatar mcollina commented on May 3, 2024

@dominictobias can you please confirm that #60 (comment) can be used to reproduce the problem?

from compress.

sekoyo avatar sekoyo commented on May 3, 2024

Ah don't worry, I speed read on a number of issues and this is a general problem with npm cache and windows, rather than something koa specific 😳

from compress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.