metro icon indicating copy to clipboard operation
metro copied to clipboard

SIGSEGV with watchman

Open jack-beanstalk-2022 opened this issue 1 year ago • 2 comments

I am using Metro with watchman 2024.12.02.00, I got

  Metro:FileMap Error: Command failed: watchman list-capabilities --output-encoding=json --no-spawn
  Metro:FileMap *** Aborted at 1735069258 (Unix time, try 'date -d @1735069258') ***
  Metro:FileMap *** Signal 11 (SIGSEGV) (0x0) received by PID 90 (pthread TID 0x7ffffcb8f4c0) (linux TID 90) (code: address not mapped to object), stack trace: ***
  Metro:FileMap (error retrieving stack trace)
  Metro:FileMap
  Metro:FileMap     at genericNodeError (node:internal/errors:983:15)
  Metro:FileMap     at wrappedFn (node:internal/errors:537:14)
  Metro:FileMap     at ChildProcess.exithandler (node:child_process:414:12)
  Metro:FileMap     at ChildProcess.emit (node:events:513:28)
  Metro:FileMap     at maybeClose (node:internal/child_process:1101:16)
  Metro:FileMap     at Socket.<anonymous> (node:internal/child_process:457:11)
  Metro:FileMap     at Socket.emit (node:events:513:28)
  Metro:FileMap     at Pipe.<anonymous> (node:net:351:12) +117ms

The problem is the "--no-spawn" option, I got segmentation fault on a terminal when I do

watchman shutdown-server
watchman list-capabilities --no-spawn
zsh: segmentation fault  watchman list-capabilities --no-spawn

Code pointer: https://github.com/facebook/metro/blob/f7343dad4a9d7f4d2e4b71f07b88038dfac0fa36/packages/metro-file-map/src/lib/checkWatchmanCapabilities.js#L28

Question: is this due to my watchman version? Or should this --no-spawn option be removed?

jack-beanstalk-2022 avatar Dec 24 '24 20:12 jack-beanstalk-2022

Huh, interesting! --no-spawn is a documented Watchman option that prevents it starting a server just because we've asked it what capabilities it supports. It wouldn't break things to remove it, but it'd mean Watchman starts unnecessarily in rare cases.

This looks like a watchman bug. What's your platform and how did you install watchman?

robhogan avatar Dec 24 '24 20:12 robhogan

The first error log is from a ubuntu container running on the cloud The terminal error is from macOS

watchman version 2024.12.02.00 installed by home-brew

jack-beanstalk-2022 avatar Dec 29 '24 00:12 jack-beanstalk-2022