stylelint: Segmentation fault (core dumped)

What steps are needed to reproduce the bug?

Just install latest version.

What Stylelint configuration is needed to reproduce the bug?

NA

How did you run Stylelint?

stylelint --cache <path>

Which version of Stylelint or dependencies are you using?

15.6.3

What did you expect to happen?

Run without errors.

What actually happened?

It crashes with this exception: Segmentation fault (core dumped)

Does the bug relate to non-standard syntax?

No

Proposal to fix the bug

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 22
  • Comments: 37 (24 by maintainers)

Commits related to this issue

Most upvoted comments

I added this in my package.json to temporarily avoid the issues :

(I use npm)

  "overrides": {
    "stylelint": {
      "cosmiconfig": "8.1.3"
    }
  },

https://github.com/stylelint/stylelint/releases/tag/15.7.0 is released! 🎉 The segmentation fault should not occur. 👍🏼

@rcerljenko Thanks for the report. I doubt this is a problem of Cosmiconfig:

Can you confirm a workaround to downgrade Cosmiconfig to 8.1.3?

Thanks for the help, everyone.

For now, I agree with doing a patch release, pinning cosmiconfig. 👍🏼 I’ll prepare for the release right now.

I’ve opened follow-up issues:

So, I’m closing this issue since it’s no longer needed. Feel free to comment if you still have any concerns.

Thank you so much for helping us resolve this problem!

Great thanks, @romainmenke! I’ve merged #6902.

I’ll do a patch release today. See also #6903.

I agree with removing v8-compiler-cache if there are no more concerns. 👍🏼

To confirm, if people try using .stylelintrc.mjs (ESM), can #6902 prevent this problem?

I guess you would still have to remove that weird cache package for that to work.

I also occur this problem:

lQLPJx-0LdicJQLMrM0E1LCs79agXXVZTAR0XIPlwBIA_1236_172

“stylelint”: “^15.6.3”

This issue can occasionally be reproduced on my MBP, but it can be reproduced every time on the CI Linux.

image

Currently, I don’t think we should support .mjs explicitly. See also below (CLI help and doc):

https://github.com/stylelint/stylelint/blob/f1ace6167d1145f875050452f17b3e11494fac05/lib/cli.js#L115-L118

https://github.com/stylelint/stylelint/blob/f1ace6167d1145f875050452f17b3e11494fac05/docs/user-guide/configure.md?plain=1#L5-L8

But, we note that some people may try using .mjs if Cosmiconfig 8.2 is installed. Let’s consider it later, though.

@d-fischer Is there any reason not to use the sync loaders?

Should be fine; as cosmiconfig uses await, a non-promise result should be handled just fine. The only (obscure) breakage I could imagine would be a file that includes a then property at the root level, which might just crash with an obscure error. If you want to be extra sure about that corner case, I guess you could do something like

'.js': (path, content) => Promise.resolve(defaultLoadersSync['.js'](path, content)),

Well, uh, that makes sense. cosmiconfig migrated to vitest for this reason. Apparently, the switch is relatively straightforward.

Hi, cosmiconfig maintainer here.

For some reason, within stylelint, any call to import() crashes. Do you have any idea why that could be? In general, even though stylelint is written in CJS. it shouldn’t have any problems calling dynamic import()…

I have tried running the full prettier test suite, no issues with that… I’m not sure what’s different here.

Confirmed that:

  "pnpm": {
    "overrides": {
      "cosmiconfig": "8.1.3"
    }
  },

fixes the issue

I can confirmed lock “cosmiconfig”: “8.1.3” works