less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.02k stars 3.41k forks source link

v4 fails to import https resources on macOS, works in v3 #3693

Closed joeyparrish closed 2 years ago

joeyparrish commented 2 years ago

To reproduce:

@import (css, inline) "https://fonts.googleapis.com/css?family=Roboto";

Current behavior: Fails with ECONNRESET on macOS with less v4.1.2, but succeeds with less v3.13.1. Doesn't fail on Linux or Windows. Reproducible in GitHub Actions as well as on our private mac hardware.

Expected behavior: Should be able to fetch https resources equally on all platforms.

Environment information:

mhnaeem commented 2 years ago

Facing this same issue on my mac as well

Possibly related issue: https://github.com/nodejs/node/issues/27916

joeyparrish commented 2 years ago

I've traced it to needle, a new dependency of less.js. They remove their error listener after closing the connection, but nodejs fires an error after that.

joeyparrish commented 2 years ago

See https://github.com/tomas/needle/issues/391

iChenLei commented 2 years ago

Thanks for bug report, wait upstream deps to fix it.

joeyparrish commented 2 years ago

A new version of needle is available upstream. As soon as I can write a regression test for less.js, I'll put up a PR to upgrade needle.

joeyparrish commented 2 years ago

There seems to be a timing component to the issue. The simplest possible regression test doesn't reproduce the issue, but the full set of less files in shaka-project/shaka-player does.

Also, the issue does not appear in node v12, but does appear in v14, v16, and v17.

If I can't modify an existing inline-https test to fail on mac without the fix, I may give up on a regression test. I'd prefer not to, though.

joeyparrish commented 2 years ago

If I strip away some of shaka-player's less files, the repro rate goes down steadily, from 100% repro with all of them, down to 0% for just an https inline import statement.

I can't find a simple, non-project-specific repro case for a regression test, so I'm giving up.

I can confirm, though, that with the needle upgrade, shaka-player's less build works 100% of the time on our mac with node 17.

joeyparrish commented 2 years ago

Thanks so much for reviewing and merging. Looking forward to seeing the fix in an official release!

joeyparrish commented 2 years ago

Any chance we could get an updated release for less.js so we can stop using a fork?

joeyparrish commented 7 months ago

Less v4.2.0 seems to include the fix.