Commit Graph

3783 Commits

Author SHA1 Message Date
Xavier Deguillard
d6f5cad598 cli: remove implementation of eden strace
Summary:
This is the same as `eden trace fs`, redirect people to that. The command will
simply be removed later.

Reviewed By: fanzeyi

Differential Revision: D35483104

fbshipit-source-id: bdacda6c5e6f9d8d809f44b64b1178aacbee4228
2022-04-08 12:09:27 -07:00
Genevieve Helsel
3e9c2a677f add cli description for trace hg outlining emoji key
Summary: Adds a description for `eden trace hg` which outlines the meaning of the different emojis used

Reviewed By: kmancini

Differential Revision: D35473126

fbshipit-source-id: 32c67aa728cf2065255cfbb0227eb52f74d672df
2022-04-08 10:09:52 -07:00
Jan Mazur
4c2458a9d1 import git-config with patch #372 and #377 backported on 0.1.11
Summary: I did submit another fix to upstream, then I backported it on top of 0.1.11.

Differential Revision: D35494891

fbshipit-source-id: 4ba29ba35e556926b30e9c47569381d506d1b8a7
2022-04-08 07:59:13 -07:00
Andreas Backx
180ac8ecc6 upgrade tracing-subscriber from 0.3.9 to 0.3.10
Summary: 0.3.10 adds a new EnvFilter builder that I would like to use. :)

Reviewed By: wqfish

Differential Revision: D35473723

fbshipit-source-id: df31dad09c8f8fc9c27a43c85b5d6ac8f97d69a3
2022-04-08 04:00:03 -07:00
Yipu Miao
ffab8acc6a SetPathObjectId should avoid mount-wise operations
Reviewed By: chadaustin

Differential Revision: D35104663

fbshipit-source-id: 0dd00e3a1a3f8af9869b7eca459bb622cab66992
2022-04-07 16:15:41 -07:00
Katie Mancini
3893aa9cf6 log extra connections to NFS server
Summary:
We have seen that sometimes the a client sends us nfsv4 requests with the
nfsv3 version on it.

We fail to parse those.

It's likely the kernel that is sending us that event, but technically any client
could connect to us, so we don't know that for sure.

Let's make sure we log if we see more than one client connected to us. so that
we can confirm if this is the kernel or not.

We should probably also not let non kernel clients connect to us. But I have not
figured out how to do that. tbd

Reviewed By: fanzeyi

Differential Revision: D35448531

fbshipit-source-id: e0810c8961c18b305b80bb874ae4f6aee9583d07
2022-04-07 15:34:08 -07:00
Sean Karlage
937c5b0010 Allow XDG_CACHE_HOME in Eden environment
Summary:
ASIC homedirs are stored on NFS. Eden/hg's new caching solution by default places contents in the home directory which can lead to concurrency issues when reading/writing to this shared NFS cache dir, especially for CI (which all runs as the same user).

To mitigate, we can set XDG_CACHE_HOME to point to a non-NFS directory where cached contents should be written. However, Eden only propagates these allowlisted environment variables throughout the lifetime of the EdenFS daemon. Let's ensure we can also pass XDG_CACHE_HOME through to the daemon process as well.

Reviewed By: chadaustin, mrkmndz

Differential Revision: D35402429

fbshipit-source-id: 0ce5b71838bcf384ea20427cf01b2fe9a107f69c
2022-04-07 14:42:03 -07:00
Genevieve Helsel
8430ff731c show import priority and cause in eden trace hg
Summary:
This aims to let `hg trace hg` answer the "why was this blob/tree imported" question.

Emojis chosen (welcome to suggestion here):
HgImportPriority::LOW �
HgImportPriority::MEDIUM �
HgImportPriority::HIGH �

HgImportCause::UNKNOWN �
HgImportCause::FS �
HgImportCause::THRIFT �
HgImportCause::PREFETCH �

Reviewed By: kmancini

Differential Revision: D34966918

fbshipit-source-id: ed830510752b53b01bcab53b4a8e0a8d4b3c7974
2022-04-07 13:05:18 -07:00
Xavier Deguillard
8cd52b7b99 eden: query EdenFS instead of Mercurial
Summary:
EdenFS does support answering a status query between 2 commits, by using it, we
can avoid forking to Mercurial which is a very expensive operation. We can also
benefit from EdenFS computing these concurrently instead of running these
status sequentially.

The code is almost identical to the one present in scm/Mercurial.cpp with some
copy/pasted bits. The main difference being the lack of LRU caches. I've
decided against these LRU caches as I've noticed Watchman consumming a large
amount of memory due to the status call potentially containing a very large
amount of strings. Since the cost of asking EdenFS for status should be
significantly less than Mercurial (no Python startup time, no Python code,
etc), not having caches is likely OK.

Lastly, we still fallback to the `hg status` path when alwaysIncludeDirectories
is set to avoid complexifying the code.

Reviewed By: chadaustin

Differential Revision: D35445851

fbshipit-source-id: ae939b71e8f6c60e5724cde5fc42753fddae2570
2022-04-07 12:00:20 -07:00
Genevieve Helsel
3693c486ae remove option to log file accesses to edenfs_file_stats_accesses
Reviewed By: kmancini

Differential Revision: D35265781

fbshipit-source-id: 1504bafb705a8f63beed2e1d215e639b4cf89f67
2022-04-07 11:18:28 -07:00
Michael Cuevas
38070d87da upload entire minidumps
Summary: We were limiting the minidump uploads to 977KB. This allows the whole minidump file to be uploaded instead.

Reviewed By: fanzeyi

Differential Revision: D35449385

fbshipit-source-id: f4d8966fee5eda312639adbc476bf9f72c1aec43
2022-04-07 09:41:57 -07:00
Michael Cuevas
208abe7820 limit the number of minidumps collected by eden rage
Summary: By default, we collect every minidump from the last week. This can be a lot. Let's limit the collection amount to 3.

Reviewed By: fanzeyi

Differential Revision: D35449132

fbshipit-source-id: 158f22b6d4083958b26f34bdfc56ba3099aa0be6
2022-04-07 09:41:57 -07:00
Michael Cuevas
822dd15348 refactor logging statement
Summary: reuse the string from earlier in the function

Reviewed By: kmancini

Differential Revision: D35334023

fbshipit-source-id: 61fc2989d5ca56eaa9c703a1725106ebb60f295f
2022-04-07 09:41:57 -07:00
Michael Cuevas
069c536a5d enable/disable notifications from E-Menu
Summary: Add the ability to enable/disable notifications from the E-Menu

Reviewed By: chadaustin

Differential Revision: D35269912

fbshipit-source-id: d51e224ea4fbf7c4c700573f7f672641a3961883
2022-04-07 09:41:57 -07:00
Michael Cuevas
8be9a1c8c1 fix updateLastShown logic
Summary: the logic used before was wrong. Fix it so that we handle all cases correctly (before we ignored the config option to turn off notifications but handled notification frequency correctly)

Reviewed By: chadaustin

Differential Revision: D35270735

fbshipit-source-id: d0be2e202fb37062e2ed73c909b9bf0e8251b343
2022-04-07 09:41:57 -07:00
Michael Cuevas
ab218e4ca4 add generic notifications to notifier interface
Summary: adds a general purpose notification method (send a notification with any title/body combo)

Reviewed By: chadaustin

Differential Revision: D34453071

fbshipit-source-id: 886fcca310c82ca50340570ecebf7182e9a72f7d
2022-04-07 09:41:57 -07:00
Michael Cuevas
57e2a0c72b change the E-Menu Guid
Summary:
An old development GUID was used. This caused some users to be unable to start Eden with the E-Menu enabled because the GUID was associated with another executable file path. See here: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa

"The binary file that contains the icon was moved. The path of the binary file is included in the registration of the icon's GUID and cannot be changed. Settings associated with the icon are preserved through an upgrade only if the file path and GUID are unchanged. If the path must be changed, the application should remove any GUID information that was added when the existing icon was registered. Once that information is removed, you can move the binary file to a new location and reregister it with a new GUID. Any settings associated with the original GUID registration will be lost.
This also occurs in the case of a side-by-side installation. When dealing with a side-by-side installation, new versions of the application should update the GUID of the binary file."

Reviewed By: chadaustin

Differential Revision: D35302987

fbshipit-source-id: 8c898a93047ae30b97853ca31400dd1c927a39f4
2022-04-07 09:41:57 -07:00
Michael Cuevas
e3db5a417e Fix stale E-Menu bug
Summary:
Shell_NotifyIcon(NIM_ADD) fails if there's a stale icon in the notification tray. This caused Eden to crash upon startup.

Instead of blindly adding each time, We should first call Shell_NotifyIcon(NIM_DELETE) to ensure any stale icons are removed.

We should also avoid crashing EdenFS if NIM_ADD fails.

Reviewed By: chadaustin

Differential Revision: D35302853

fbshipit-source-id: cf3f3062f96eada83fcde54616b2407e13779b0c
2022-04-07 09:41:57 -07:00
Michael Cuevas
3670118823 add e-menu resource file to cmake build
Summary: The Cmake build didn't properly link the E-Menu resource file. That caused EdenFS to crash on startup if users had the E-Menu enabled.

Reviewed By: chadaustin

Differential Revision: D35288550

fbshipit-source-id: 27f2f29a53ab2717fd9fd874a2cd89b81ccbb9b7
2022-04-07 09:41:57 -07:00
Huapeng Zhou
a232791ef1 rust: update anyhow to 1.0.56
Summary:
Needed by cloud-hypervisor https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/Cargo.toml#L19.

(Note: this ignores all push blocking failures!)

Reviewed By: jsgf

Differential Revision: D34432496

fbshipit-source-id: deaa320c74a22e325a116bcc0d5b0120c4f3744b
2022-04-07 04:31:34 -07:00
Genevieve Helsel
5fa9133ac7 set prefetch-profiles.prefetching-enabled to default to true in the cli
Summary: This was set to default to true in `EdenConfig.h` but was not set here

Reviewed By: chadaustin

Differential Revision: D35440139

fbshipit-source-id: cf3102bea40ae639c767dd6488924fd843556d48
2022-04-06 16:52:15 -07:00
Xavier Deguillard
9e853e1409 doctor: add a Windows checker to check the sha1 of loaded files
Summary:
One of the issue some users have seen on Windows on a regular basis is when the
content of files on disk differs from what EdenFS thinks the content should be.
This leads to `hg status` not reporting the correct output and sometimes random
build failures. At first, let's try to detect these occurences. This diff focus
on only computing the sha1 of files that have been fully read already as
reading other files would force EdenFS to populate them on disk.

Reviewed By: kmancini

Differential Revision: D34776469

fbshipit-source-id: d04d31f7f7bfba85cbfbf68ce55f5490bbaec45f
2022-04-06 15:41:38 -07:00
Xavier Deguillard
1fd9b86803 doctor: add checker for materialized files
Summary:
On Windows, we've had cases where EdenFS disagrees with the state of the
filesystem. EdenFS may believe that some files are materialized, while they
aren't present on disk. This checker should ensure that we detect these cases.

In a future diff, automatic remediation will be added.

Reviewed By: kmancini

Differential Revision: D34775506

fbshipit-source-id: 3eaa1761fd8acd0fbbfd9f965b35c712c28f2f97
2022-04-06 15:41:38 -07:00
Genevieve Helsel
f7fb63af3e change the size of ImportPriorityKind and ObjectFetchContext members
Summary: changes `ImportPriorityKind` and members in `ObjectFetchContext` to `uint8_t`, these should be minimized for use in `HgImportTraceEvent`

Reviewed By: xavierd

Differential Revision: D35269554

fbshipit-source-id: f36752b41e653338704316a8a75e2bbc72317e4a
2022-04-05 11:39:07 -07:00
John Watson
a4ad600cb9 Add symlink patch to tar-rs
Summary:
Pulling in this patch until the **[patch](f4f439ca0c)** ~~is approved, lands, and~~ makes it into crates.io

NOTE: I feel a little awkward patching ***everyone*** here — I suspect I'm the only that cares.
 **[I attempted to add a "tar-symlink" package pinned to 4.38](https://www.internalfb.com/intern/paste/P491303978/?view=diff)**, with the patch applying to that,
but and then updating only `dotsync2` accordingly, but that results in the same cascading changes
seen here; I suspect due to the patch applying to package "tar" (since "tar-symlink" isn't a thing).

Reviewed By: zertosh

Differential Revision: D35350696

fbshipit-source-id: a5653f3aed0eb5bc5424906d24a53ec2c2b79211
2022-04-05 11:26:24 -07:00
Katie Mancini
3d1eb3a8f9 move process name cache
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This diff:
finally actually moves over process name cache

Reviewed By: chadaustin

Differential Revision: D34218020

fbshipit-source-id: 1e51ec6524d1e67a1dfd4d03a8189f882f5d3ff1
2022-04-04 11:37:38 -07:00
Katie Mancini
2a7ecc039c move benchharness
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This diff:

process name cache has some benchmark tests so I am moving benchharness over.

Reviewed By: chadaustin

Differential Revision: D34218024

fbshipit-source-id: 260730adb7e5d4a3131e72fa2f03cc4c5066c075
2022-04-04 11:37:38 -07:00
Katie Mancini
1891bbddec move StringConv
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This diff:

process name cache depends on StringConv.h so I am moving that over.

Reviewed By: chadaustin

Differential Revision: D34218023

fbshipit-source-id: d928768a6b5f737a1c546c6f3c73acc5535fc44c
2022-04-04 11:37:38 -07:00
Katie Mancini
f9b8b89509 move win error
Summary:
Stack context:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

This Diff:

process name cache depends on WinError.h so I am moving that over.

Reviewed By: chadaustin

Differential Revision: D34218026

fbshipit-source-id: 064f5bfc50c4ba120c887b01ff1f0a3e0543d498
2022-04-04 11:37:38 -07:00
Katie Mancini
d69e8c766a move handle
Summary:
To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

Diff:

process name cache depends on Handle.h so I am moving that over.

Reviewed By: chadaustin

Differential Revision: D34218022

fbshipit-source-id: 05c42eb0fa8be78fd001249c0c09ed7fa515ea44
2022-04-04 11:37:38 -07:00
Katie Mancini
1f44f4a882 move Synchronized
Summary:
Stack context:

To get a build setup for edencommon I picked an eden library to move over
to edencommon.

I picked process name cache. I would like to have this library in watchman
so that I can log spawning process command lines as well as client command
lines.

Diff:

process name cache depends on Synchronized so I am moving that over in this diff.

Reviewed By: chadaustin

Differential Revision: D34218021

fbshipit-source-id: 528e7b4b12476b33a294a342e6e4ee13c92c7361
2022-04-04 11:37:38 -07:00
Xavier Deguillard
c9d83d8faa prjfs: do not error out on file not found when adding a placeholder
Summary:
I've just hit this, and it looks like this is just an omission. In
PrjDeleteFile above, we check for both of these status, let's do the same here.

Reviewed By: chadaustin

Differential Revision: D35320619

fbshipit-source-id: 34d24035dfee09de809d13371d15b8ba93be4bb5
2022-04-01 13:14:45 -07:00
Zeyi (Rice) Fan
7b95b98626 cli: compatibility with older Python 3
Summary:
Certain users have older Python 3 version installed and it would cause issues on these machine.

This diff fixes them.

Reviewed By: kmancini

Differential Revision: D35150380

fbshipit-source-id: e230b6990114ef1835724aa34e4307873b34b93f
2022-04-01 12:53:44 -07:00
Katie Mancini
de4d0e0c99 fix checkout directory to non directory
Summary:
We have a few error reports of
```

Reviewed By: xavierd

Differential Revision: D35264311

fbshipit-source-id: 4a601a8b8da7aa89eede94060105ebffaf777e83
2022-03-31 18:19:01 -07:00
Xavier Deguillard
902a329f47 cli: create symlink redirections atomically on Windows
Summary:
Symlink creation on Windows is non-atomic, that is the symlink is first created
as a directory, and then a reparse tag is added to it. For EdenFS, this means
that when the notification thread queries the filesystem, it may either see
that the symlink is a directory, or a symlink, depending on whether EdenFS wins
the race.

If EdenFS finds out that this is a directory, it will try to recursively add
every file and directory under it to the inode hierarchy, which can be
extremely slow. Some users have noticed new clones taking many minutes to
answer a simple `hg status` query due to that query waiting on all pending
notifications to be completed and EdenFS is still processing the symlink.

To solve this in an ad-hoc way, we can force a symlink to be created atomically
by first creating it outside of the repository, and then moving it in the
repository. The rename operation is atomic, and thus EdenFS always detect it as
a symlink!

Reviewed By: jtbraun

Differential Revision: D35263809

fbshipit-source-id: e6794976551838bfaba994e83f610d6c776422a2
2022-03-31 12:59:44 -07:00
Jan Mazur
0285b086e5 import git-config with patch #372 backported on 0.1.11
Summary:
I'm going to use this crate to prepare and parse git config on git servers.

I had to add functionality to the crate: https://github.com/Byron/gitoxide/pull/372

I backported it to the version that currently is the latest one on crates.io.

Reviewed By: dtolnay

Differential Revision: D35283393

fbshipit-source-id: 89094a5077e982a2988e0de4e5b379304a080297
2022-03-31 12:40:20 -07:00
Huapeng Zhou
484f6b1be2 rust: update thiserror to 1.0.30
Summary: Needed to import [cloud-hypervisor](https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/Cargo.toml#L31).

Reviewed By: dtolnay

Differential Revision: D34437972

fbshipit-source-id: 9f22bb1fde83308a319f40e138d9ab7f180c7fa0
2022-03-31 00:26:06 -07:00
Jonathan Keljo
cc1f45f4f3 Upgrade lru-disk-cache to 0.4.1
Reviewed By: dtolnay

Differential Revision: D35238243

fbshipit-source-id: c4d7c07f3c317c2bc64588cea963354c6ca06faa
2022-03-30 12:24:17 -07:00
Michael Cuevas
e0a106aa0e add version and uptime info to E-Menu
Summary:
This adds an "About Eden" section to the E-Menu which lists the current running EdenFS version and uptime.

We approximate the uptime by passing chrono::now to the Windows Notifier when we create it (it should be very-very-very close since we create the Notifier when we start the Daemon. Therefore, the uptime of the two should be equal).

Reviewed By: chadaustin

Differential Revision: D34968215

fbshipit-source-id: 726d1229b880e2ae10c2950ac4a50f36badfe9db
2022-03-30 09:55:44 -07:00
Michael Cuevas
3d252cc921 add debug option to eden menu
Summary: This diff allows users to enable a debug menu inside the eden menu.

Reviewed By: chadaustin

Differential Revision: D34585649

fbshipit-source-id: 01d24000ddb0141757fef45c2b7fc8ac7b438fe3
2022-03-30 09:55:44 -07:00
Michael Cuevas
af0a872f41 add Windows notifier
Summary: adds notification icon on Eden daemon startup

Reviewed By: chadaustin

Differential Revision: D34322066

fbshipit-source-id: 0a75591ab74015c02626925a90185866b9e07cab
2022-03-30 09:55:44 -07:00
Michael Cuevas
287b540f6c silence unused param warning on Windows
Summary: Windows builds complain about mainEventBase being unused because of the #ifndef. Add a [[maybe_unused]] to silence the compiler.

Reviewed By: kmancini

Differential Revision: D35240507

fbshipit-source-id: c06d945530d6a881878c9952bf0900ec50966e62
2022-03-30 09:55:44 -07:00
Katie Mancini
63ad96b091 Support access calls
Summary:
In the NFS protocol, the client does not completely resolve permissions based
on the access bits in the mode field of stat.

Clients make a special call into NFS, ACCESS, to check if a certain user has
permissions to perform some operation on a file or directory.

Access was perviously unimplemented for NFS and returned open permissions.

This fully implements the access procedure.

Reviewed By: xavierd

Differential Revision: D34632815

fbshipit-source-id: eda39e02c12c189cd1fc3a32dbe864f00d2c3458
2022-03-29 10:21:05 -07:00
Xavier Deguillard
3bb809f2b7 rage: collect stacktrace of EdenFS on Windows
Summary:
Similarly to macOS where we collect a `sample` of EdenFS, it is also a good
idea to do the same for Windows. To do this, a debugger is attached to EdenFS
and the stacktraces of all the threads are collected.

Reviewed By: genevievehelsel

Differential Revision: D34400523

fbshipit-source-id: cb3f930fbba465c4ae00166e6e1816461a6072a4
2022-03-28 20:58:45 -07:00
Katie Mancini
7ba3360a97 really weird std::optional + delayed destructor bug
Summary:
my eden-dev on my M1 is always crashing on `eden stop` with this trace:

```
Assertion failed: (dd_->guardCount_ > 0), function ~DestructorGuard, file DelayedDestructionBase.h, line 96.
*** Aborted at 1648171587 (Unix time, try 'date -d 1648171587') ***
*** Signal 6 (SIGABRT) (0x1bb2fd9b8) received by PID 31226 (pthread TID 0x115a58580) (maybe from PID 31226, UID 501) (code: 0), stack trace: ***
I0324 18:26:27.215606 6572327 EdenServer.cpp:1574] mount point "/Users/kmancini/t-fbsource" stopped
V0324 18:26:27.215625 6572327 EdenMount.cpp:800] beginning shutdown for EdenMount /Users/kmancini/t-fbsource
0   edenfs#macosx-arm64                 0x000000010626a968 _ZN5folly10symbolizer17getStackTraceSafeEPmm + 36
1   edenfs#macosx-arm64                 0x000000010611739c _ZN5folly10symbolizer21SafeStackTracePrinter15printStackTraceEb + 108
2   edenfs#macosx-arm64                 0x000000010603e854 _ZN5folly10symbolizer12_GLOBAL__N_118innerSignalHandlerEiP9__siginfoPv + 232
3   edenfs#macosx-arm64                 0x000000010603c9d4 _ZN5folly10symbolizer12_GLOBAL__N_113signalHandlerEiP9__siginfoPv + 108
4   libsystem_platform.dylib            0x00000001bb3484e4 _sigtramp + 56
5   libsystem_pthread.dylib             0x00000001bb330eb0 pthread_kill + 288
6   libsystem_c.dylib                   0x00000001bb26e314 abort + 164
7   libsystem_c.dylib                   0x00000001bb26d72c err + 0
8   edenfs#macosx-arm64                 0x0000000105148ab0 _ZN5folly22DelayedDestructionBase15DestructorGuardD2 (45261a919d)Ev + 180
9   edenfs#macosx-arm64                 0x0000000105143438 _ZN5folly22DelayedDestructionBase15DestructorGuardD1 (19e5072be0)Ev + 28
10  edenfs#macosx-arm64                 0x0000000104df1eb0 _ZNSt3__124__optional_destruct_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d)Ev + 44
11  edenfs#macosx-arm64                 0x0000000104df1e74 _ZNSt3__123__optional_storage_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d)Ev + 28
12  edenfs#macosx-arm64                 0x0000000104df1e48 _ZNSt3__120__optional_copy_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d)Ev + 28
13  edenfs#macosx-arm64                 0x0000000104df1e1c _ZNSt3__120__optional_move_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d)Ev + 28
14  edenfs#macosx-arm64                 0x0000000104df1df0 _ZNSt3__127__optional_copy_assign_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d)Ev + 28
15  edenfs#macosx-arm64                 0x0000000104df1dc4 _ZNSt3__127__optional_move_assign_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d)Ev + 28
16  edenfs#macosx-arm64                 0x0000000104df1d98 _ZNSt3__18optionalIN5folly22DelayedDestructionBase15DestructorGuardEED2 (45261a919d)Ev + 28
17  edenfs#macosx-arm64                 0x0000000104df1bb8 _ZNSt3__18optionalIN5folly22DelayedDestructionBase15DestructorGuardEED1 (19e5072be0)Ev + 28
18  edenfs#macosx-arm64                 0x0000000104df3364 _ZN8facebook4eden9RpcServer17RpcAcceptCallbackD2 (45261a919d)Ev + 60
19  edenfs#macosx-arm64                 0x0000000104df0bd0 _ZN8facebook4eden9RpcServer17RpcAcceptCallbackD1 (19e5072be0)Ev + 28
20  edenfs#macosx-arm64                 0x0000000104df0bfc _ZN8facebook4eden9RpcServer17RpcAcceptCallbackD0Ev + 28
21  edenfs#macosx-arm64                 0x0000000102dfc330 _ZN5folly18DelayedDestruction16onDelayedDestroyEb + 88
22  edenfs#macosx-arm64                 0x0000000105148aec _ZN5folly22DelayedDestructionBase15DestructorGuardD2 (45261a919d)Ev + 240
23  edenfs#macosx-arm64                 0x0000000105143438 _ZN5folly22DelayedDestructionBase15DestructorGuardD1 (19e5072be0)Ev + 28
24  edenfs#macosx-arm64                 0x0000000104dedf3c _ZNSt3__124__optional_destruct_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EE5resetEv + 40
25  edenfs#macosx-arm64                 0x0000000104dede20 _ZN8facebook4eden9RpcServer17RpcAcceptCallback13acceptStoppedEv + 416
26  edenfs#macosx-arm64                 0x000000010514c260 _ZZN5folly17AsyncServerSocket14RemoteAcceptor4stopEPNS_9EventBaseEPNS0_14AcceptCallbackEENK3$_1clEv + 44
27  edenfs#macosx-arm64                 0x000000010514c228 _ZN5folly6detail8function14FunctionTraitsIFvvEE9callSmallIZNS_17AsyncServerSocket14RemoteAcceptor4stopEPNS_9EventBaseEPNS6_14AcceptCallbackEE3$_1EEvRNS1_4DataE + 32
28  edenfs#macosx-arm64                 0x0000000101fc287c _ZN5folly6detail8function14FunctionTraitsIFvvEEclEv + 40
29  edenfs#macosx-arm64                 0x0000000105d3b40c _ZN5folly9EventBase20FunctionLoopCallback15runLoopCallbackEv + 32
30  edenfs#macosx-arm64                 0x0000000105d3476c _ZN5folly9EventBase16runLoopCallbacksERN5boost9intrusive4listINS0_12LoopCallbackENS2_18constant_time_sizeILb0EEEvvvEE + 120
31  edenfs#macosx-arm64                 0x0000000105d31ef0 _ZN5folly9EventBase16runLoopCallbacksEv + 88
32  edenfs#macosx-arm64                 0x0000000105d336a8 _ZN5folly9EventBase8loopBodyEib + 1396
33  edenfs#macosx-arm64                 0x0000000105d31c10 _ZN5folly9EventBase8loopOnceEi + 44
34  edenfs#macosx-arm64                 0x000000010201a700 _ZN8facebook4eden10EdenServer14performCleanupEv + 2004
35  edenfs#macosx-arm64                 0x0000000101fb8d80 _ZN8facebook4eden11runEdenMainEONS0_8EdenMainEiPPc + 3240
36  edenfs#macosx-arm64                 0x0000000101f5e56c main + 56
37  dyld                                0x00000001159e50f4 start + 520
(safe mode, symbolizer not available)
```

for some reason the destructor is being called twice even though the constructor is only called once.

this makes the delated destructor count double decrement and hit its internal assert.

I think this is because std::optional is directly calling the destructor on the value maybe and so it is being double destructed.

keeping a direct member variable gets rid of the crash.

This probably deserves a follow up to understand why std::optional is doing this.

Reviewed By: xavierd

Differential Revision: D35134797

fbshipit-source-id: 6b9184c878962b7f773f6be55ac70a83dc00fa42
2022-03-25 13:43:16 -07:00
Katie Mancini
84057e7171 make parsing errors non fatal and log them
Summary:
If an NFS client sends us an improperly formatted request, EdenFS crashes.
This is dangerous because any process on the machine could send us an NFS
request and this could crash eden.

Eden should be resilient to badly formatted requests/requests it fails to
parse.

This will make debugging failed requests harder as errors will be less
obvious to the user, but it will also allow users to keep using their mount
after a failed request.

Reviewed By: xavierd

Differential Revision: D34981438

fbshipit-source-id: 107de2324b1dc145bd426398614ee76b72c5c446
2022-03-24 15:20:43 -07:00
Xavier Deguillard
8d81c03848 prjfs: remove a bogus XDCHECK
Summary:
This XDCHECK isn't really bogus, but ProjectedFS is sometimes closing
directories that were never opened.

Reviewed By: genevievehelsel

Differential Revision: D35030993

fbshipit-source-id: fe764a89b06c32deaa1412b4d5fa4ee63fd94866
2022-03-23 17:08:48 -07:00
Xavier Deguillard
3d8504c10f prjfs: reduce the time directories are kept opened
Summary:
Thanks to ImmediateFuture not deferring anything in the fast path,
recursivelyAddAllChildrens may recursively add all the childrens without
sleeping or returning control to the executor. The downside is that directories
can be held open for a long time, and on Windows, this would prevent subsequent
operations on the directories themself.

Unity in particular is found of creating directories, adding files, renaming
the directory, etc in a very fast fashion. And in some cases, EdenFS would hold
the directory opened for too long, raising an error in Unity which would affect
users. To reduce this, we can simply collect all the directory entry names
first and then recursively handle them after the directory is closed.

Reviewed By: chadaustin

Differential Revision: D35018455

fbshipit-source-id: 8f074ff794c64d2a65607fc0829ec444b80ddb9a
2022-03-23 13:59:52 -07:00
Xavier Deguillard
83e08ada44 utils: add a getAllDirectoryEntryNames function
Summary:
This opens the directory and reads all the names from it, excluding "." and
"..". On Windows, this function is written in such a way that it allows
concurrent deletion/renaming of the directory while this is running.

Reviewed By: chadaustin

Differential Revision: D35067144

fbshipit-source-id: 20fb8f9ac8a49970cb360eb3307e86d846760e98
2022-03-23 13:59:52 -07:00
Xavier Deguillard
fe7cc8b0a9 pathfuncs: remove boost::filesystem exported dependency
Summary:
The PathFuncs.h header is included pretty much everywhere in EdenFS, and thus
its compile speed affects the entirety of EdenFS. Unfortunately, the
boost::filesystem dependency is pretty large and is thus slowing down the
compilation.

Since the few methods that rely on Boost are only used in one place, let's
instead inline the use of Boost in these places.

Reviewed By: chadaustin, fanzeyi

Differential Revision: D35058316

fbshipit-source-id: b80a39f1575acc0fa4b9e64eb5375b95b4b421da
2022-03-22 15:48:40 -07:00