Skip to content

Commit 07d037f

Browse files
yakimantjakubgs
authored andcommitted
nix: downgrade watchman to 4.9.0
watchman was upgraded significantly during the last #14944 (4.9.0 (Aug 16, 2017) to 2023.01.30.00 - 6 years between): status-im/nixpkgs@4e9c02b Probably causing developers to have "too many files open" issue #16341 This PR is an attempt to fix the issue by downgrading the watchman Signed-off-by: Jakub Sokołowski <jakub@status.im>
1 parent 36a72f2 commit 07d037f

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

nix/overlay.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ in {
4949
doCheck = false;
5050
});
5151

52+
# Downgrade watchman in attempt to fix "too many files open issue"
53+
watchman = callPackage ./pkgs/watchman {
54+
inherit (super.darwin.apple_sdk.frameworks) CoreServices;
55+
autoconf = super.buildPackages.autoconf269;
56+
};
57+
5258
# Package version adjustments
5359
gradle = super.gradle_7;
5460
nodejs = super.nodejs-18_x;

nix/pkgs/watchman/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Issue
2+
3+
`watchman` was upgraded significantly during the last nixpkgs upgrade (`4.9.0` (Aug 16, 2017) to `2023.01.30.00` - 6 years between):
4+
- https://github.com/status-im/status-mobile/pull/14944
5+
- https://github.com/status-im/nixpkgs/commit/4e9c02bcc709fe1737a746add0e8e0109133d808
6+
7+
Probably causing developers to have "too many files open" issue:
8+
https://github.com/status-im/status-mobile/issues/16341
9+
10+
```
11+
Error: A non-recoverable condition has triggered. Watchman needs your help!
12+
The triggering condition was at timestamp=1687286390: opendir(/Users/javid/Projects/status-mobile/node_modules/metro-core/node_modules/jest-regex-util/build) -> Too many open files
13+
All requests will continue to fail with this message until you resolve
14+
the underlying problem. You will find more information on fixing this at
15+
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-opendir
16+
```
17+
18+
# Fix
19+
This is an attempt to fix the issue by downgrading the watchman
20+
21+
# Upgrade
22+
When upgrading in the future, please read the comments:
23+
https://github.com/status-im/status-mobile/issues/16341

nix/pkgs/watchman/default.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{ stdenv, lib, config, fetchFromGitHub, autoconf, automake, pcre
2+
, libtool, pkg-config, openssl
3+
, confFile ? config.watchman.confFile or null
4+
, withApple ? stdenv.isDarwin, CoreServices
5+
}:
6+
7+
stdenv.mkDerivation rec {
8+
pname = "watchman";
9+
version = "4.9.0";
10+
11+
src = fetchFromGitHub {
12+
owner = "facebook";
13+
repo = "watchman";
14+
rev = "v${version}";
15+
sha256 = "0fdaj5pmicm6j17d5q7px800m5rmam1a400x3hv1iiifnmhgnkal";
16+
};
17+
18+
nativeBuildInputs = [ autoconf automake pkg-config libtool ];
19+
buildInputs = [ pcre openssl ]
20+
#++ lib.optionals withApple [ CoreServices ];
21+
++ lib.optionals stdenv.isDarwin [ CoreServices ];
22+
23+
configureFlags = [
24+
"--enable-lenient"
25+
"--enable-conffile=${if confFile == null then "no" else confFile}"
26+
"--with-pcre=yes"
27+
28+
# For security considerations re: --disable-statedir, see:
29+
# https://github.com/facebook/watchman/issues/178
30+
"--disable-statedir"
31+
];
32+
33+
prePatch = ''
34+
patchShebangs .
35+
'';
36+
37+
preConfigure = ''
38+
./autogen.sh
39+
'';
40+
41+
meta = with lib; {
42+
description = "Watches files and takes action when they change";
43+
homepage = "https://facebook.github.io/watchman";
44+
maintainers = with maintainers; [ cstrahan ];
45+
platforms = with platforms; linux ++ darwin;
46+
license = licenses.asl20;
47+
};
48+
}

0 commit comments

Comments
 (0)