mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
When Tailwind is loaded in a Node Worker thread, it currently causes a segmentation fault on Linux when the thread exits. This is due to a longstanding issue in Rust that affects all native modules: https://github.com/rust-lang/rust/issues/91979. I reported this years ago but unfortunately it is still not fixed, and seems to have gotten worse in Rust 1.83.0 and later. Looks like Tailwind recently updated Rust versions and this issue started appearing when run in tools like Parcel that use worker threads. The workaround is to prevent the native module from ever being unloaded. One way to do that is to always load the native module in the main thread in addition to workers, but this is hard to enforce. @Brooooooklyn found another method, which is to use a linker option for this. I tested this on an Ubuntu system and verified it fixed the issue. You can test with the following script. ```js // test.js const {Worker} = require('worker_threads'); new Worker('./worker.js'); // worker.js require('@tailwindcss/oxide'); ``` Without this change, a segmentation fault will occur. --------- Co-authored-by: Jordan Pittman <jordan@cryptica.me>
52 lines
1.3 KiB
JSON
52 lines
1.3 KiB
JSON
{
|
|
"$schema": "https://turbo.build/schema.json",
|
|
"ui": "tui",
|
|
"tasks": {
|
|
"@tailwindcss/oxide#build": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": ["./index.d.ts", "./index.js", "./*.node"],
|
|
"inputs": [
|
|
"./src/**/*",
|
|
"./build.rs",
|
|
"./package.json",
|
|
"./Cargo.toml",
|
|
"./.cargo/config.toml",
|
|
"../oxide/src/**/*",
|
|
"../oxide/Cargo.toml",
|
|
"../Cargo.toml",
|
|
"../package.json"
|
|
]
|
|
},
|
|
"@tailwindcss/oxide#dev": {
|
|
"dependsOn": ["^dev"],
|
|
"outputs": ["./index.d.ts", "./index.js", "./*.node"],
|
|
"inputs": [
|
|
"./src/**/*",
|
|
"./build.rs",
|
|
"./package.json",
|
|
"./Cargo.toml",
|
|
"./.cargo/config.toml",
|
|
"../oxide/src/**/*",
|
|
"../oxide/Cargo.toml",
|
|
"../Cargo.toml",
|
|
"../package.json"
|
|
],
|
|
"cache": false,
|
|
"persistent": true
|
|
},
|
|
"build": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": ["dist/**"],
|
|
"env": ["FEATURES_ENV"]
|
|
},
|
|
"lint": {},
|
|
"dev": {
|
|
"cache": false,
|
|
"persistent": true
|
|
}
|
|
},
|
|
// If rustup is installed outside of the default ~/.rustup directory, we need
|
|
// to pass the path through to the individual rust tasks.
|
|
"globalPassThroughEnv": ["RUSTUP_HOME"]
|
|
}
|