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

nix: stop passing watchman socket to Nix builds #13784

Merged
merged 2 commits into from
Aug 10, 2022
Merged

Conversation

jakubgs
Copy link
Member

@jakubgs jakubgs commented Aug 9, 2022

This passing of Watchman socket was implemented in order to avoid this:

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:204:21)
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (/private/tmp/nix-build-status-mobile-build-nightly-android.drv-0/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (node:events:527:28)
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

Which is caused by jest-haste-map used by metro starting to watch the filesystem for file changes, which is pointless when doing a one-off build using Nix. But by setting CI=true we can make metro not start this waching of files in the first place, removing the need for use of Watchman entirely.

By entirely dropping use of Watchman we also fix the following issue:

[cli] unable to talk to your watchman on /tmp/tmp-status-mobile-ABC/jenkins-state/sock! (Permission denied)

Which happens on multi-user Nix installations becuase the user that the Nix build is executed as is not the same as the user that starts Watchman and creates the socket file.

Issue: #13783

@jakubgs jakubgs requested a review from a team August 9, 2022 18:54
@jakubgs jakubgs self-assigned this Aug 9, 2022
@status-github-bot status-github-bot bot added this to REVIEW in Pipeline for QA Aug 9, 2022
@status-im-auto
Copy link
Member

status-im-auto commented Aug 9, 2022

Jenkins Builds

Click to see older builds (6)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 74c13e6 #1 2022-08-09 19:01:53 ~7 min android-e2e 📦apk 📲
✔️ 74c13e6 #1 2022-08-09 19:01:56 ~7 min android 📦apk 📲
✔️ 74c13e6 #1 2022-08-09 19:04:53 ~10 min ios 📦ipa 📲
✔️ cbbb46c #2 2022-08-09 19:31:34 ~8 min android-e2e 📦apk 📲
✔️ cbbb46c #2 2022-08-09 19:32:09 ~8 min android 📦apk 📲
✔️ cbbb46c #2 2022-08-09 19:33:34 ~10 min ios 📦ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6a5a981 #3 2022-08-09 19:45:57 ~7 min android-e2e 📦apk 📲
✔️ 6a5a981 #3 2022-08-09 19:46:35 ~7 min android 📦apk 📲
✔️ 6a5a981 #3 2022-08-09 19:49:51 ~10 min ios 📦ipa 📲
✔️ 95af16f #4 2022-08-10 00:28:55 ~7 min android 📦apk 📲
✔️ 95af16f #4 2022-08-10 00:29:04 ~7 min android-e2e 📦apk 📲
✔️ 95af16f #4 2022-08-10 00:31:56 ~10 min ios 📦ipa 📲

@jakubgs jakubgs force-pushed the nix/drop-watchman branch 2 times, most recently from cbbb46c to 6a5a981 Compare August 9, 2022 19:38
@jakubgs jakubgs marked this pull request as ready for review August 9, 2022 19:46
This passing of Watchman socket was implemented in order to avoid this:
```
Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:204:21)
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (/private/tmp/nix-build-status-mobile-build-nightly-android.drv-0/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (node:events:527:28)
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}
```
Which is caused by `jest-haste-map` used by `metro` starting to watch
the filesystem for file changes, which is pointless when doing a
one-off build using Nix.

But by setting `CI=true` we can make `metro` not start this waching of
files in the first place, removing the need for use of Watchman entirely.

By entirely dropping use of Watchman we also fix the following issue:
```
[cli] unable to talk to your watchman on /tmp/tmp-status-mobile-ABC/jenkins-state/sock! (Permission denied)
```
Which happens on multi-user Nix installations becuase the user that the
Nix build is executed as is not the same as the user that starts
Watchman and creates the socket file.

Issue: #13783

Signed-off-by: Jakub Sokołowski <jakub@status.im>
MacOS permissions are stupid:
```
 > ls -l /dev/stderr
lr-xr-xr-x  1 root  wheel  0 Jun 20 20:45 /dev/stderr -> fd/2
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
@jakubgs jakubgs merged commit 95af16f into develop Aug 10, 2022
Pipeline for QA automation moved this from REVIEW to DONE Aug 10, 2022
@jakubgs jakubgs deleted the nix/drop-watchman branch August 10, 2022 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants