Commit Graph

46 Commits

Author SHA1 Message Date
Genevieve (Genna) Helsel
575c86e400 fix TARGETS files for autodeps
Summary: The fix is being worked on, but to reduce confusion, its probably worth just changing our TARGETS files since its a no-op change

Reviewed By: jdelliot

Differential Revision: D56495193

fbshipit-source-id: 10370b333cfd8ef316f9f257009ba4200869e21e
2024-04-23 17:17:20 -07:00
John Elliott
e90196bcb0 Move SpawnedProcess from eden to edencommon
Summary:
To support better telemetry and logging in watchman we want to use Eden's components. Lets migrate and detangle the needed pieces.

This change moves SpawnedProcess from eden to edencommon.

Reviewed By: genevievehelsel

Differential Revision: D54471128

fbshipit-source-id: 5c8caa7d6388ba9a3753cb483ba8d11adc5eb87c
2024-03-04 12:22:09 -08:00
John Elliott
36ae764747 Move utils:utils from eden to edencommon (part 1)
Summary:
To support better telemetry and logging in watchman we want to use Eden's components. Lets migrate and detangle the needed pieces.

This change moves utils:utils from eden to edencommon.

NOTE: This is a large diff, so breaking the tests into separate subsequent diff.

Reviewed By: genevievehelsel

Differential Revision: D54442939

fbshipit-source-id: 1cfbfa10d2dc4bbf7379d700978198b8b6788c71
2024-03-04 12:22:09 -08:00
John Elliott
bb37cf9419 Move SystemError from eden to edencommon
Summary:
To support better telemetry and logging in watchman we want to use Eden's components. Lets migrate and detangle the needed pieces.

This change moves SystemError from eden to edencommon.

Reviewed By: MichaelCuevas

Differential Revision: D54343729

fbshipit-source-id: 7861e3effc9d242fbeda34333078c14c4d021a80
2024-02-29 21:00:21 -08:00
generatedunixname89002005287564
08d6a097c9 eden (7547650190731062666)
Reviewed By: xavierd

Differential Revision: D51107904

fbshipit-source-id: ff8dbf0f085d59d464c37e03d68a7d8a99913204
2023-11-08 17:55:00 -08:00
Facebook GitHub Bot
df8fba6e6d Re-sync with internal repository
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.
2023-10-11 22:09:00 -07:00
Michael Cuevas
2d0766cfeb E-Menu: avoid crashing due to WndProc failures
Summary: We're seeing even more users that are crashing due to win32 errors. It seems like these sorts of E-Menu issues shouldn't crash Eden entirely. A non-functional E-Menu is better than crashing Eden entirely. Therefore, let's log these as errors for now.

Reviewed By: xavierd

Differential Revision: D45365471

fbshipit-source-id: f4092a9d44c1c5e6749e52d7e656c5de339551d3
2023-04-28 15:19:07 -07:00
Michael Cuevas
4aa3c38e5e E-Menu: avoid crashing due to WndProc failures
Summary:
We've seen at least 1 user that crashed due to:

```
E0417 09:41:18.412118 20840 WindowsNotifier.cpp:68] TrackPopupMenuEx failed: Error (0x5a6) Popup menu already active.
F0417 09:41:18.434692 20840 WindowsNotifier.cpp:454] Exception occurred in E-Menu WndProc: TrackPopupMenuEx failed: Error (0x5a6) Popup menu already active.
```

Failures like this really shouldn't cause the entirety of Eden to crash, so let's ignore it for now.

Reviewed By: chadaustin

Differential Revision: D45130458

fbshipit-source-id: f906a17ac359f2a3c48a852d0668f70014ccd63d
2023-04-26 17:01:58 -07:00
Xavier Deguillard
eda170e8b4 notifications: properly handle exception when creating E-Menu
Summary:
The EdenFS telemetry shows that 90% the vast majority of all the EdenFS crashes
on Windows occur very shortly after starting up, with most of these pointing to
~thread failing. This is triggered by a non-detached thread not being joined.
Looking at backtraces containing symbols and sources, the crash appears to
occur due to the windowsEventLoop throwing an exception but never being joined,
due to the ~WindowsNotifier never being called.

To fix this, we can simply split the WindowsNotifier constructor in 2: the
construtor, and an initialize method that may throw. This ensures the
destructor is always called.

Reviewed By: MichaelCuevas

Differential Revision: D42272618

fbshipit-source-id: bf092573b3e4de2210a2b9c6124bf93c718cb3ae
2022-12-29 11:10:58 -08:00
Jonathan Worobey
c2ccd86556 EdenFS Windows E-Menu displays active mounts and their tracked inode counts
Summary: Adds a per active mount inode population count status report to the E-Menu.

Reviewed By: MichaelCuevas

Differential Revision: D38997531

fbshipit-source-id: 1646b22cd55a32db8d8baec09acc1f201f641349
2022-09-20 14:28:09 -07:00
Yedidya Feldblum
77384974a1 fix violation of unused-variable
Summary:
Fix the following violation of `Wunused-variable`:
```
eden/fs/notifications/CommandNotifier.cpp: In function ‘bool facebook::eden::{anonymous}::isGenericConnectivityError(const std::exception&)’:
eden/fs/notifications/CommandNotifier.cpp:24:20: warning: unused variable ‘timeout’ [-Wunused-variable]
   } else if (auto* timeout = dynamic_cast<const folly::FutureTimeout*>(&err)) {
                    ^~~~~~~
```

Reviewed By: chadaustin

Differential Revision: D38284711

fbshipit-source-id: 95338c54406af55f87c5f4ae4675e134e0debd5e
2022-08-16 19:43:40 -07:00
Zeyi (Rice) Fan
b56f28bf22 common: rename utils -> edencommon_utils
Summary:
Fixes https://github.com/facebookexperimental/edencommon/issues/3

`utils` is a bit too generic and Gentoo seems to be building edencommon into a shared library.

Reviewed By: chadaustin

Differential Revision: D38719753

fbshipit-source-id: fb46b6a7c9d3bcc3034765cb47e997a80c646b3d
2022-08-16 11:23:53 -07:00
Michael Cuevas
6cdf4c5385 add log viewer to E-Menu
Summary: Many users are unaware that EdenFS logs exist. Even if they're aware they exist, they probably don't know the log location. We should give users easy access to the logs through the E-Menu.

Reviewed By: fanzeyi

Differential Revision: D36989417

fbshipit-source-id: b3db965f4dbcf2e50640949a69a5eff2958ae8f2
2022-06-08 17:22:48 -07:00
Chad Austin
9fa292b9ed standardize namespaces on C++17 syntax
Reviewed By: genevievehelsel

Differential Revision: D36429182

fbshipit-source-id: 7d355917abf463493c37139856810de13e1090ff
2022-05-17 10:12:56 -07:00
Michael Cuevas
3c4afb88e3 add manifest to cmake build
Summary:
Cmake automatically includes its own manifest in executables. We should make CMake aware of our custom manifest so that it combines them together to avoid a "duplicate manifest" error

In addition, we should only include the manifest in the resource file if we're building with buck. The Cmake build will break if we try to include the manifest in the resource file. This is because every target that includes notifications will pull in the resource file, and this causes all of those targets to have duplicated manifest errors during linking.

Reviewed By: chadaustin

Differential Revision: D36318044

fbshipit-source-id: dde35e5602f0161c4961103970b880f98e399098
2022-05-11 17:51:31 -07:00
Michael Cuevas
2b0326d24e add clean option to E-Menu
Summary: Users commonly run into disk usage issues. We should make this command more discoverable by adding it to the E-Menu

Reviewed By: chadaustin

Differential Revision: D36294731

fbshipit-source-id: bbd2f2bd66540188160ca3486da8142913bcc785
2022-05-11 17:51:31 -07:00
Michael Cuevas
ba21ed9a26 refactor E-Menu string usage
Summary: A majority of the strings used by the E-Menu were only used once. It doesn't make sense to have them all defined at the top of the cpp file. Instead, we should only define the ones that are used multiple times.

Reviewed By: chadaustin

Differential Revision: D36294347

fbshipit-source-id: e00c55ced14550dbd8a0ec8a58a8643c3ec24af9
2022-05-10 17:52:20 -07:00
Michael Cuevas
89e40b8f51 add sub-menus to E-Menu
Summary:
Windows allows nesting of sub-menus:

> A submenu typically contains command items, but it can also contain items that open nested submenus. By adding such items to submenus, you can nest menus to any depth.

We should probably limit the nesting level to a max of 3-4.

For now, let's nest some of the debug menu entries so that the debug menu doesn't grow too large too quickly.

Reviewed By: chadaustin

Differential Revision: D36262251

fbshipit-source-id: 8d3f103ad6ef3e0f068286c2b416d5cccac2d81d
2022-05-10 17:52:20 -07:00
Michael Cuevas
fbede92795 add several commands to E-Menu
Summary:
Add `eden rage`, `eden doctor` and `eden list` to the E-Menu under the actions sub-menu.

These commands are now more easily discovered by users.

Reviewed By: chadaustin

Differential Revision: D36262679

fbshipit-source-id: 56aa0ba67df71966a831c516141edf415520681e
2022-05-10 17:52:20 -07:00
Michael Cuevas
9977664a5e fix E-Menu pop-up location
Summary: Before, the E-Menu would always pop-up in the bottom right corner of the display. Now, it should pop-up wherever the cursor is positioned.

Reviewed By: chadaustin

Differential Revision: D36262555

fbshipit-source-id: c17f1e57559f552873f4c2ba2b6506974fd215b2
2022-05-10 17:52:20 -07:00
Michael Cuevas
98d1f32ecd clean up E-Menu code
Reviewed By: chadaustin

Differential Revision: D36139493

fbshipit-source-id: 2b04c30161de36fa2f86e1af0c369b463a11179d
2022-05-04 21:20:06 -07:00
Michael Cuevas
23fd6f25d0 add --press-to-continue flag to edenfsctl commands
Summary:
When an `edenfsctl` command is invoked from the E-Menu, a PowerShell Window is opened and is immediately closed once the command finishes. This makes it hard/impossible for the user to see the command's output.

The desired behavior here is to keep the Window open long enough for the user to acknowledge the output. I did this by adding a `--press-to-continue` flag to all `edenfsctl` commands. This will mainly be used by the E-Menu, but may have uses elsewhere.

Reviewed By: chadaustin

Differential Revision: D36137709

fbshipit-source-id: a46bebb5bb5820949cd4b70579a29406afb34048
2022-05-04 21:20:06 -07:00
Michael Cuevas
fac63e6190 change E-Menu tooltip during checkout
Summary:
change the tooltip during a checkout operation. Also change it back when the checkout finishes.

The debug menu can also enable this tooltip by changing the icon color to orange. Changing the color to green or white will change the tooltip back

A similar tooltip is also implemented for when EdenFS detects an unhealthy mount

Reviewed By: kmancini

Differential Revision: D35488235

fbshipit-source-id: a33ebfd15cbfd0d46eea85f32be4ddd1bb09f357
2022-04-28 01:07:18 -07:00
Michael Cuevas
7931fbd3fd change e-menu icon during checkout
Summary:
On Windows, EdenFS should signal that it's working on a checkout operation by changing the color of the E-Menu.

We also add a debug menu option for changing the E-Menu color

Reviewed By: chadaustin

Differential Revision: D35487175

fbshipit-source-id: fae587a223e9ce910e5558b36008a8c97b9dd3ea
2022-04-28 01:07:18 -07:00
Michael Cuevas
2d0c705c55 change format of E-Menu uptime
Summary: before, if we exceeded 24 hours of uptime the E-Menu would roll over to 0 hours of uptime. We can avoid this by adding days to the uptime print out. We don't print out the number of days if the uptime is less than 1 day.

Reviewed By: chadaustin

Differential Revision: D35954540

fbshipit-source-id: 9285433a827f8494b840e9d551cb6504f94417b7
2022-04-27 14:09:57 -07:00
Michael Cuevas
fab88670df change wording in the "About EdenFS" message box
Summary: Keep usage of Eden vs EdenFS consistent. Also update the title of the message box so it's consistent with the menu item

Reviewed By: chadaustin

Differential Revision: D35951678

fbshipit-source-id: fb62f6edf66ba9159a50130de9ed3a13fff7a1e2
2022-04-27 00:06:24 -07:00
Michael Cuevas
c0f4bca1cd change e-menu wording
Summary: "Quit E-Menu" is ambiguous and could mean a number of things. We should make it clear that clicking this menu option will cause the E-Menu notification icon to be hidden

Reviewed By: chadaustin

Differential Revision: D35950442

fbshipit-source-id: 86527479dae544bc7db3e596e3bf8477bd147213
2022-04-27 00:06:24 -07:00
Michael Cuevas
df8b625c7f document potential race condition
Summary: We can potentially race if we try to update notificationStatus_ from outside the event thread. As long as we only try to update from within the single thread, we should be fine.

Reviewed By: kmancini

Differential Revision: D35514682

fbshipit-source-id: 0ee8baec6816cebf91fe4fe1c95f1156b5064a42
2022-04-27 00:06:24 -07:00
Michael Cuevas
e71bd8cb4e add report button to E-Menu
Summary: This menu item will cause a shell to be launched and `eden rage --report` to be run.

Reviewed By: chadaustin

Differential Revision: D35327029

fbshipit-source-id: b17c90386e8beb028848fa3d99927dae3c971add
2022-04-25 16:44:06 -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
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
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
aa4732e433 refactor notifications
Summary:
Refactor the existing notification class so it uses the new Notifier interface. The notifier interface will be used to set up notifications/notification trays on different platforms.

The notifier interface is not fully completed yet. More methods will be added in a future diff.

As of now, we only have 1 Notifier, the command notifier. I hope to remove this notifier once we implement notifiers for all platforms that we support.

Reviewed By: chadaustin

Differential Revision: D34291809

fbshipit-source-id: a2a67af2683f1f88781428e8d88191f49e100e96
2022-03-01 17:52:58 -08:00
Xavier Deguillard
a29d465ee8 fs: fix license header
Summary:
With Facebook having been renamed Meta Platforms, we need to change the license
headers.

Reviewed By: fanzeyi

Differential Revision: D33407812

fbshipit-source-id: b11bfbbf13a48873f0cea75f212cc7b07a68fb2e
2022-01-04 15:00:07 -08:00
Xavier Deguillard
a810f38e6b notifications: support Windows
Summary:
On Windows, /bin/sh doesn't exist. To spawn a command in a shell, we need to
use Powershell.

Reviewed By: genevievehelsel

Differential Revision: D24864355

fbshipit-source-id: 3bcf630a90e644a31ff9db8fea9891476cad641d
2020-11-11 09:37:56 -08:00
Xavier Deguillard
99a1771351 notifications: compile on Windows
Summary:
While it's unlikely to work properly (it uses /bin/sh), it compiles properly on
Windows, so let's include it in the build.

Reviewed By: wez

Differential Revision: D23520368

fbshipit-source-id: 267ba04f98f5dacc81e1772f86f5ad43c846815d
2020-09-09 09:33:35 -07:00
Wez Furlong
154d7309c9 eden: introduce SpawnedProcess
Summary:
This commit introduces a new process spawning class derived
from the ChildProcess class in the watchman codebase.

`SpawnedProcess` is similar to folly::Subprocess but is designed around the
idea that we will use a system provided spawning API to start a process, rather
than assuming the use of `fork`.

`fork` is to be avoided because it can be expensive for processes with large
address spaces and also because it interacts poorly with threads on macOS.  In
particular, we see the objC runtime terminating our process in some scenarios
where fork and threads are mixed.

There are some important differences from `folly::Subprocess` and that means
that some assumptions and uses need to be altered slightly from their prior
workings.  For example, detaching a SpawnedProcess moves the responsibility of
waiting on the child to a periodic task as there is no way to detach via
posix_spawn without also using fork.

On the plus side, this commit allows unifying spawning between posix and
windows systems, which simplifies the code!

Reviewed By: xavierd

Differential Revision: D23287763

fbshipit-source-id: b662af1d7eaaa9ed445c42f6c5765ae9af975eea
2020-09-01 13:31:32 -07:00
Wez Furlong
28f7b4a0b0 eden: show desktop notification for blob/tree fetch errors
Summary:
This commit causes a desktop notification to be shown if we generate
EIO or ETIMEDOUT responses via fuse; the prompt is intended to make it obvious
to the user that they need to connect to the VPN.

The commit by itself doesn't show a notification, it allows configuring a
command that can be run to do something to show a notification.

The test plan includes one such configuration for our corp environment.

* It doesn't trigger for thrift-originated downloads (eg: prefetch), only for
  VFS operations through FUSE.
* Ideally we'd know exactly when we have a network related error in the store
  code and use that to trigger the notification.  However, we have a rather
  convoluted set of importers and fallbacks today, one of which is interpreting
  a generic response returned from a pipe, so it is not especially clear
  exactly where we should locate the logic

Reviewed By: chadaustin

Differential Revision: D17513364

fbshipit-source-id: 45134f3672679cb5580cb0c1bc12a0d6e38525ca
2020-02-10 08:28:49 -08:00