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

Tailwindcss v.2+ css rules with class name selectors also used in tailwindcss classes in combination with @apply with the same class name produces nodejs v8 fatal error #3541

Closed
mayoujin opened this issue Feb 7, 2021 · 1 comment

Comments

@mayoujin
Copy link

mayoujin commented Feb 7, 2021

Describe the problem:

Using css rules with class selector which used in Tailwindcss version 2+ with @apply rule with the same class name explodes nodejs v8.
Such a rule (accidentally typed)

.hidden, .some-class {
  @apply hidden;
}

produces fatal error which hard to detect conditions of it:

<--- Last few GCs --->

[13335:0x1046ad000]   222952 ms: Mark-sweep (reduce) 2021.6 (2050.9) -> 2020.9 (2052.2) MB, 2180.6 / 0.0 ms  (average mu = 0.130, current mu = 0.005) allocation failure scavenge might not succeed
[13335:0x1046ad000]   226153 ms: Mark-sweep (reduce) 2021.9 (2054.2) -> 2021.2 (2054.4) MB, 3124.8 / 0.0 ms  (average mu = 0.070, current mu = 0.024) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x1012d96a5 node::Abort() (.cold.1) [/usr/local/bin/node]
 2: 0x1000a6309 node::Abort() [/usr/local/bin/node]
 3: 0x1000a646f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 4: 0x1001e8f57 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0x1001e8ef3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 6: 0x100395df5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
 7: 0x10039789a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
 8: 0x100392fc5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
 9: 0x1003908f0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
10: 0x10039efda v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x10039f061 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
12: 0x10036d137 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
13: 0x1006ebfc8 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x100a718f9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]

Json report applied.
report.20210207.200910.12722.0.001.json.log

@mayoujin mayoujin changed the title Css rule wih Tailwindcss v.2+ css rules with class name selectors also used in tailwindcss in combination @apply with the same class name produces nodejs v8 fatal error Feb 7, 2021
@mayoujin mayoujin changed the title Tailwindcss v.2+ css rules with class name selectors also used in tailwindcss in combination @apply with the same class name produces nodejs v8 fatal error Tailwindcss v.2+ css rules with class name selectors also used in tailwindcss classes in combination with @apply with the same class name produces nodejs v8 fatal error Feb 7, 2021
@adamwathan
Copy link
Member

Hey! This is a circular dependency causing infinite recursion, you are trying to apply hidden to itself. Apply copies all instances of a selector and does so recursively, so this understandably blows things up.

Not sure what your desired output is in this situation but if you want to start a discussion thread explaining what you're trying to achieve happy to help there.

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

No branches or pull requests

2 participants