Граф коммитов

157 Коммитов

Автор SHA1 Сообщение Дата
Aleksandar Milicevic 4ae372ea90 Merged PR 607317: [LinuxSandbox] Implement a file descriptor table
To get an absolute path for a file descriptor, we used to call `readlink("/proc/self/fd/{fd}")`.  That's perfectly fine and still the best way to do it; the problem is that it is slow.  (for example, it is not uncommon that a C compiler calls `putc` millions of times to produce a build output).

This PR implements a file descriptor table where where a mapping from a file descriptor to an absolute path is cached.

A new entry is computed and inserted into the table whenever a path for a file descriptor is needed but it hasn't already been computed.

Because file descriptors may be reused for different files over time, whenever a file descriptor is closed (i.e., the `close` syscall is intercepted) the corresponding entry in the table is invalidated.

Related work items: #1833259
2021-04-08 18:43:53 +00:00
Oleksii Kononenko 223d816b16 Merged PR 605157: Resolve component governance alert
Resolve component governance alert

Related work items: #1829177
2021-03-26 02:07:40 +00:00
Aleksandar Milicevic 929fa77f3a Merged PR 603931: Publish linux runtime v0.0.43
Includes John's recent changes.
2021-03-23 04:14:58 +00:00
Serge Mera 8ae0d8e6fc Merged PR 602764: Fix reparse point cache invalidation logic
Consider the following scenario:

1. Absent probe on path A/B/C/file.txt
2. Reparse point created on C in path A/B/C, where now A/B/C -> D/E/F and D/E/F/file.txt exists.
3. Present probe on path A/B/C/file.txt (by virtue of 2)

Step 1) populates the reparse point cache with A/B/C/file.txt as not needing resolution (since the path is absent). 2) should invalidate A/B/C, and now A/B/C does need resolution because C is a reparse point. But A/B/C/file.txt does not get invalidated, and therefore when 3) happens, A/B/C/file.txt is not resolved. This manifests in a cache miss when file.txt is a produced output, since we don't compensate for the absence of the file on cache lookup when the unresolved path is stored.

This PR adds:
* A conservative invalidation on reparse point creation (we don't detour the ioctl call, but we see a handle being opened for write and reparse point flags as the immediately previous operation). We invalidate the path in that case to stay on the safe side.
* A tracking mechanism for all descendants of a given path that the reparse point cache knows about. When invalidating a path, all descendants stored in the cache are also invalidated. This accounts for the above scenario, where when C is turned into a reparse point, both A/B/C and A/B/C/file.txt are invalidated
* A lightweight C++ unit test infrastructure (using boost) with unit tests for the new structure.

Related work items: #1824112
2021-03-16 07:29:35 +00:00
Sergey Tepliakov e6dca5ae4f Merged PR 599867: Downgrading RuntimeContracts to 0.3.0 to avoid build failures
Downgrading RuntimeContracts to 0.3.0 to avoid build failures
2021-02-25 23:14:57 +00:00
Julian Bayardo 7d8aa1a67e Merged PR 593608: Upgrade StackExchange.Redis to 2.2.4
This would fix this issue that bit us in production a couple months ago: d28a43a139
2021-02-25 18:37:23 +00:00
Sergey Tepliakov fbb1499a8c Merged PR 599486: Observe and Dispose CancellationTokenRegistration
This PR updates the version of ErrorProne.NET CoreAnalyzers that now detects an unobserved calls to `CancellationToken.Register`.

It is important to observe and dispose the `CancellationTokenRegistration` instance when they obtained from non-local `CancellationToken`s because otherwise we may ended up with a memory leak when a longer-lived object will hold references to a transient closures created by the callbacks provided to `CancellationToken.Register`.
2021-02-24 23:02:04 +00:00
Sergey Tepliakov 7bec6b4315 Merged PR 599428: Update RuntimeContracts and RuntimeContracts.Analyzer
Update RuntimeContracts and RuntimeContracts.Analyzer for performance reasons.
2021-02-24 00:13:26 +00:00
Sergey Tepliakov e645f01d98 Merged PR 599075: Update NLog to 4.7.7 and use built-in prop to avoid excessive allocations
It seems that the hack I've added to avoid allocations is not needed.

One of the NLog maintainers opened a bug: https://github.com/microsoft/BuildXL/issues/1283 with the explanation of the right solution and this PR uses the proposed solution instead of relying on a custom target I've created previously.
2021-02-23 22:57:22 +00:00
Semih Okur 3d57a276ff Merged PR 594337: Ugrade AsyncFixer to v1.5.1 and fix the new async cases
In my little spare time, I found a chance to improve AsyncFixer not to forget my coding skills. Here are changes needed to upgrade to v1.5.1:
- Fixed false negatives, especially for 01:UnnecessaryAsync. That's why I had to remove many redundant async/await keywords. It is always faster to directly return the Task. We rarely need async/await keywords in redundant cases due to some special exception handling. However, we have suppressed "01:UnnecessaryAsync" in only one case at our codebase so far.
- Fixed false positives for other analyzers, especially for 02:BlockingCallInsideAsync. I removed many suppressions, which made me pretty happy.

I am still OOF, but I did not want to postpone these changes. I have also open-sourced AsyncFixer. Feel free to contribute: https://github.com/semihokur/asyncfixer

@<Sergey Tepliakov>, there are several cases where we use async/await keywords with the new using statement syntax. You reported that at some point as far as I remember. I improved AsyncFixer to detect cases like below so that it does not suggest removing async/await

```
async Task foo()
{
    using var stream = new MemoryStream();
    int streamOperation()
    {
        return stream.Read(null);
    }

    Task t = Task.Run(() => streamOperation());
    await t;
}
```

@<John Erickson>, could you please point me to the artifact services projects where AsyncFixer is enabled? I can upgrade AsyncFixer in those projects as well.
2021-01-28 01:27:14 +00:00
Sergey Tepliakov cc0dece14c Merged PR 592575: Add source generators to bxl
This PR adds a facility to bxl sdk to use source generators and also it adds one source generator that can generate struct-based record-like behavior as well as two other generators that can:
* Generate ToString implementation similar to records ToString behavior but with the ability to fine tune the final ToString impl.
* Generate equality members.

Related work items: #1805964
2021-01-15 18:05:27 +00:00
Rijul Luman 25d9e283b7 Merged PR 592544: Consuming Build Manifest Generation Library and Performance fixes
Consuming Build Manifest Generation Library and Performance fixes

Related work items: #1794240, #1803820
2021-01-13 19:14:44 +00:00
Juan Carlos Guzman Islas 3d30730250 Merged PR 592750: Remove TransientFaultHandling completely
Remove TransientFaultHandling completely. Polly has been tested for a while now and this should simplify our dependencies.
The only trace of it left is that ADO packages depend on it.

Related work items: #1807652
2021-01-12 22:13:03 +00:00
Iman Narasamdya eed332d697 Merged PR 592553: Upgrade ref assemblies version
Upgrade ref assemblies version
2021-01-11 22:56:55 +00:00
Rijul Luman 5ec0c179ce Merged PR 592288: Revert 'Consuming Microsoft.ManifestGenerator nuget from BXL'
Reverts !589728

Related work items: #1794240
2021-01-08 20:27:44 +00:00
Rijul Luman 713fbe1dc7 Merged PR 592266: Revert 'Upgrade Microsoft.ManifestGenerator to 0.1.3'
Upgrade Microsoft.ManifestGenerator to 0.1.3

Reverts !592159
2021-01-08 19:27:12 +00:00
Rijul Luman 3021feb99c Merged PR 592159: Upgrade Microsoft.ManifestGenerator to 0.1.3
Upgrade Microsoft.ManifestGenerator to 0.1.3
2021-01-08 02:26:52 +00:00
Rijul Luman c0cafd9d52 Merged PR 589728: Consuming Microsoft.ManifestGenerator nuget from BXL
Related work items: #1794240
2020-12-28 21:54:25 +00:00
Serge Mera aac7c2ae4b Merged PR 588852: Upgrade VBCSCompilerLogger to use the latest code analysis libraries and incorporate the new switches
This change implies moving the VBCSCompilerLogger to net5.0, even though BuildXL codebase is not completely there yet.

Related work items: #1799988
2020-12-10 00:44:46 +00:00
Nora Huang 0fa99c3a6b Merged PR 587278: Update nodejs version for rush test.
Update nodejs version for rush test.

Related work items: #1794623
2020-12-01 20:42:06 +00:00
Aleksandar Milicevic d8bdaaccb8 Merged PR 586774: Update NodeJS to version 15.2.1 2020-11-25 23:34:06 +00:00
Juan Carlos Guzman Islas 889440d387 Merged PR 586105: Add IcM client to the monitor
Add Icm client to the monitor

Related work items: #1762976
2020-11-24 00:22:26 +00:00
Sergey Tepliakov d71d8b9b64 Merged PR 585237: Add support for NET 5
This PR adds support for .NET 5.

The only current limitation is that QTest is disabled in .NET 5 because it was failing with some "can't find the right assembly" issue that I'm going to investigate.

Also, the default qualifier stays the same and I need some help testing the changes on the mac and on Linux.

This PR also allow us using C# 9 features like records **for all target frameworks** and the following code compiles just fine:

```csharp
public record X
    {
        public int Y { get; init; }
    }
```

Keep in mind, that you need the most recently released VS in order to see intellisense for this code.
2020-11-19 00:25:17 +00:00
Aleksandar Milicevic 818015320b Merged PR 585498: [LinuxSandbox] Report new process when libDetours.so is dynamically loaded
When a process is executed in a root jail, the root process under `chroot` is not being reported without this change.
2020-11-18 23:23:18 +00:00
Julian Bayardo 997dd18ca5 Merged PR 583301: Add compression support to RocksDb
This adds support for LZ4, Zlib and Zstd compression to our RocksDb binaries on Windows. Current compression support is:

- Linux supports lz4 and snappy
- Mac supports lz4 and snappy
- Windows supports lz4, zlib, zstd and snappy

We can build in more if we need. I only added these to the Windows binaries because it's what we'll be using in the datacenter.

Related work items: #1790176
2020-11-18 00:44:50 +00:00
Sergey Tepliakov d95dcc758e Merged PR 584959: Update csc to 3.7.0 and fix nullability warnings
This is the second PR that is required to make the final PR for adding .net5 support simpler.

The PR updates the compiler to a 3.7 version (this version does not support C# 9 yet), and fixes a bunch of nullability warnings that appear after the upgrade to 3.7 and some of them will be visible only when targeting .net 5.

This is another low risk PR.
2020-11-13 23:31:25 +00:00
Juan Carlos Guzman Islas beb44b2b0d Merged PR 584354: Add Polly as a TransientFaultHandling substitute
There is a desire to move to Polly, since TransientFaultHandling is not compatible with regular NuGet when using netstandard.

This adds the capability to put this under a flag to start testing the transition.

Related work items: #1791278
2020-11-11 20:07:23 +00:00
Juan Carlos Guzman Islas 574d0aea73 Merged PR 581813: Test ContentStoreApp.exe through unit tests
Test ContentStoreApp.exe through unit tests
2020-10-28 20:49:58 +00:00
Aleksandar Milicevic d363f6918e Merged PR 578304: [LinuxSandbox] Compile utils.c with gcc instead of g++
[LinuxSandbox] Compile utils.c with gcc instead of g++
2020-10-07 03:12:00 +00:00
Nora Huang 976c35591f Merged PR 577126: Add unit test for Linux sandbox utils.
Add unit test for Linux sandbox utils.

Related work items: #1778032
2020-10-01 07:52:21 +00:00
Aleksandar Milicevic f5e86cf5d4 Merged PR 576997: Fix ensure_env_value_with_log: it shouldn't crash when BUILDXL_LOG_PATH is not set 2020-09-29 19:05:11 +00:00
Aleksandar Milicevic 6dd7782987 Merged PR 576820: Fix memory leak in BxlObserver::InitFam()
Fix memory leak in BxlObserver::InitFam()
2020-09-29 01:38:48 +00:00
Aleksandar Milicevic c962324042 Merged PR 575787: [LinuxSandbox] Implement interposing of missing syscalls
Related work items: #1741898
2020-09-26 00:59:56 +00:00
Kristijan Simic 27466d3bb8 Merged PR 575369: [macOS] Prototype EndpointSecurity Sandbox implementation
This PR introduces a sandbox implementation based on EndpointSecurity for macOS. It is able to build projects on macOS with full sandboxing and caching (e.g. self-host builds, Apex, etc.). The general architecture is as follows:

- SystemExtension with XPC host as event broker
- BuildXL as `build host` and event manager
- Multiple EndpointSecurity clients with event buckets and dedicated report queues for process observation

Related work items: #1763841, #1763850, #1763852, #1763854
2020-09-22 16:02:00 +00:00
Serge Mera 866733e497 Merged PR 574210: Add the case for VisualBasic task in VBCSCompiler
The world moved in the MSBuild SDK and now VB tasks are being built as part of (the same old commit for) Roslyn we use for validating the MSBuild frontend. We were actually missing that case.
2020-09-16 04:20:22 +00:00
Oleksii Kononenko e67c0e4f33 Merged PR 573380: Update NodeJs and consume it from a public feed
Change NodeJs version to appease Component Governance.

Internally, we rely on private repackaged NodeJS, but it has not been updated in a while. So this PR makes everyone consume the public version (from nodejs.org).

Related work items: #1766547, #1766548
2020-09-10 05:33:48 +00:00
Aleksandar Milicevic 33efc82249 Merged PR 573376: [LinuxSandbox] Detect and report dynamically loaded libraries
Implemented using the auditing API provided by the GNU dynamic linker to observe all dynamically loaded shared libraries:

https://man7.org/linux/man-pages/man7/rtld-audit.7.html

Although the same library can be added to both LD_PRELOAD and LD_AUDIT at the same time, I couldn't do that with `libDetours.so` because it calls `dlsym` which is not available in audit callbacks.  That's why the Linux sandbox code is compiled to two (almost identical) libraries, `libDetours.so` and `libBxlAudit.so`; interposing is enabled in the former and disabled in the latter.  Both of them use the same `BxlObserver` code to check and report file accesses as soon as they happen.

Related work items: #1741898, #1750766
2020-09-09 21:16:28 +00:00
Aleksandar Milicevic 2e3fa937b2 Merged PR 572965: Remove unused nugets 2020-09-05 15:30:31 +00:00
Nora Huang 129b53695a Merged PR 569687: Fix some frontend hash check problems.
1. Check the nuget download file using the hashtype given in the hash configured instead of the build's default hashtype.
2. Do not record the hash of the downloaded file in download resolver if the file is not up to date.

Related work items: #1761395, #1761396
2020-08-18 21:51:58 +00:00
Sergey Tepliakov cfa70f5deb Merged PR 568516: Change and binding redirects to avoid failures running tests from IDE
This change extracts binding redirects information into a helper method in `BuildXLSdk` and it also adds special comments into the extracted helper and into `config.dsc`. This should help to avoid regressions in the future.

The change also fixes a NRE in tests that was caused by an attempt to reuse not fully initialized `LocalRedisProcessDatabase` instance.
2020-08-12 17:45:07 +00:00
Julian Bayardo 2ece13e06f Merged PR 567880: Roxis
This PR merges the currently experimental version of Roxis against master branch. This is required in order to make progress on testing Roxis in a CBTest stamp.

Note: most of this code is non-productive and hence shouldn't be held to the same standards. We are just making fast progress towards getting a POC working.

Things that do need to be reviewed are all changes to already-productive cache components, simply to ensure the new changes aren't breaking.

Related work items: #1746843
2020-08-08 00:31:43 +00:00
Lance Collins c29b9e1e00 Merged PR 566141: Add deployment service web scaffolding.
Add deployment service web scaffolding.
2020-08-03 18:29:15 +00:00
Aleksandar Milicevic 3fe847d9de Merged PR 564435: Update .NET Core runtime to 3.1.6
This version contains some important security patches
2020-07-16 20:03:05 +00:00
Julian Bayardo 12ef8a6184 Merged PR 551176: Add redis autoscaling to the cache monitor
This PR:
- Adds the required assemblies to be able to talk to Azure
- Adds capability to fetch metrics from Azure Monitor, and scale Redis instances
- Creates a rule for autoscaling
- Adds capability to configure the monitor via a Kusto function
- Splits the monitor into 3 dscs: App, Library and Test

The autoscaling algorithm is extremely simple on purpose:
- Fetch metrics from the last week
- Compute the maximum RPS and memory required
- Obtain the cheapest cluster size (i.e. tier and number of shards) that allows us to have an extra 30% memory and 30% expected RPS over the maximum achieved.

The complexity comes from the fact that Azure Redis scaling has plenty of business constraints on when instances can/can't be autoscaled. This means that:
- We can only choose an instance if it is reachable via autoscaling operations from the current instance size.
- When trying to reach a given instance size, we should only do so and not underprovision the stamp. If we underprovision, that could cause a production issue.

This is solved via shortest path graph traversals, which are explained in the code.

Related work items: #1666205, #1698631
2020-07-08 01:30:28 +00:00
Michael Pysson f2fc06e927 Merged PR 562047: Change Reference FileAccessAllowlist in config
Change Reference FileAccessAllowlist in config
2020-07-02 21:35:00 +00:00
Lance Collins 2bf591e2fa Merged PR 561865: Remove viewer.
Remove viewer.
2020-07-02 01:24:55 +00:00
Julian Bayardo fa323ab29b Merged PR 560582: Upgrade RocksDb to 6.10.2
Tests performed:
- Backwards compatibility by building BuildXL self-host with the new version and then the old one
- Deployment, by running CloudBuild CI release pipeline: https://dev.azure.com/mseng/Domino/_build/results?buildId=12447913&view=results
- Cache, by deploying manually onto CBTest and validating that we can boot properly. Then undeploy and check it still works.
2020-06-25 23:17:08 +00:00
Aleksandar Milicevic 4c401e9526 Merged PR 559104: [LinuxSandbox] Disable excessive logging in Release configuration 2020-06-18 00:19:18 +00:00
Aleksandar Milicevic c58bd57b6d Merged PR 558805: [LinuxSandbox] Cache reads/writes
[LinuxSandbox] Cache reads/writes
2020-06-16 22:48:35 +00:00
Sergey Tepliakov ed06c4272a Merged PR 557624: Update System.Numerics.Vectors to 4.5.0
Switching back System.Numerics.Vectors from 4.4.0 to 4.5.0 to avoid CloudBuild integration failures.
2020-06-10 21:00:39 +00:00