Comments (4)
Sorry I provided a coredump thinking you could use it, but now I realise it's not really possible. I'll try to get a coredump with a debug build and extract meaningful information from it, like full stack state, local variables, and precise line numbers, and I'll come back to you then but it might take some time since I don't know when the next crash will happen:(
from watcher.
Thanks for the report. One thing you could try would be to use a debug build to get a more accurate backtrace. You could do this by cloning the repo locally and running yarn && yarn rebuild
(or npm install && npm run rebuild
). Then use yarn link
/npm link
to link the local version into your project. Then you can run your program inside gdb
or lldb
and get a backtrace hopefully. Thanks in advance!
from watcher.
I have a coredump for the debug build now. I looked a bit with vscode inside it and found the segfault to be there:
watcher/src/linux/InotifyBackend.cc
Line 151 in 52a2dd2
The reason is that the watcher
mIgnore
property is corrupted. But also much more interesting is that the mDir
is also corrupted, at this point in the code it is equal to m\xa5z:\xf8U
.
I guess at some point the watcher data has been corrupted, but I have no clue yet on why it happened. If you want more detail or have any idea on where to look I'm all ears!
from watcher.
@devongovett Some more insight.
Just to add some context, the way I use this library is having multiple subscriptions to multiple directories. When I start my application, I start watching these directories with one subscription for each:
.
├── a
├── b
├── c
├── ...
So basically, what I do is this somewhere in my code:
const subscriptions = await Promise.all(
directories.map(
(directory) => watcher.subscribe(directory, (err, events) => processFn(directory, err, events)
)
);
Then later my code will produce some artifacts, and when everything is done I want to save a snapshot of the filesystem. So it looks like that:
const processFn = async (directory, err, events) => {
// Do some stuff
await processEventsAsync(events);
// Save a snapshot
watcher.writeSnapshot(
directory,
someFilePathThatDontInterfereWithWatchingInAnyWay
)
}
So first remark here, I know that what I do differs with what you do with parcel (v2) since in parcel there is two assumptions:
(A1). You watch only one directory: projectRoot
(if I remember well).
(A2). You write a snapshot only once
, when parcel is exiting.
I have my reasons to save a snapshot
everytime file changes, cause my code rely heavily on caching and I didn't want to pay the price of my code exiting too soon without updating the snapshot.
With this context in mind, what pops in my eyes now in the screenshot is that:
mWatched: false
Looking at the code it means that either mWatched
were never true, either this line has been called:
Line 183 in 52a2dd2
There are many places where this code can be called but not that much. Given the context, the place that I find interesting is this one:
Line 55 in 52a2dd2
Indeed, recall that the segfault is on this line:
watcher/src/linux/InotifyBackend.cc
Line 151 in 52a2dd2
So it means that we are currently processing some input events has part of the process of watching.
But like the coredump tells us, it seems the watcher instance is corrupted, ie. maybe at this point the C++ object has been destroyed because of an unref calls, which will trigger this line:
Line 187 in 52a2dd2
So maybe this segfault is really a race condition between a subscription beeing active, and calls to writeSnapshot
, all of them with the same dir
and ignore
parameters.
If this is the case, the reason why my code crash from time to time is that I am violating condition (A2), which can lead to this segfault.
What do you think ?
EDIT: another coredump today, same problem with also a corrupted watcher. Also I realized that having the mWatched
property true or false doesn't mean anything since the watcher is corrupted.. But I still think there is something true about my reasoning, waiting for your input;)
from watcher.
Related Issues (20)
- Possible deadlocks with overlapping subscriptions HOT 1
- readme backend uses unclear HOT 1
- Crash when running in alpine podman container
- Second install fails if install with pnpm and node-linker=hoisted HOT 3
- Separate packages for precompiled binaries HOT 1
- @parcel/watcher not working with Docker node:alpine image HOT 3
- Watcher not reporting events when used in docker. HOT 2
- npm ci cannot locate a prebuild for any given architecture HOT 3
- Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-arm64-musl. HOT 14
- v2.2.0 node-gyp rebuild error, incorrect scripts in npm registry HOT 11
- Specifying path to `watchman` executable HOT 1
- When using Watchman on Windows, a console window pops up when subscribing HOT 1
- gyp: binding.gyp not found (...) while trying to load binding.gyp HOT 33
- error when use node v18.18 on github runner images
- InotifyBackend hungs forever when inotify_init1 returns error HOT 1
- AWS Amplify build error HOT 2
- Github M1 Build Error sh: node-gyp-build: command not found HOT 1
- Change event is not emitted on Windows when continuously appending to an initially existing file
- when moving folder to a watched folder , only event for the moved folder is generated and not for files inside the folder
- Support for negated Ignores Globs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watcher.