Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 06f25ea

Browse files
dotnet-maestro[bot]wtgodbe
authored andcommitted
[master] Update dependencies from dotnet/coreclr (#38099)
* Update dependencies from https://github.com/dotnet/coreclr build 20190530.2 - Microsoft.NET.Sdk.IL - 3.0.0-preview6.19280.2 - Microsoft.NETCore.ILAsm - 3.0.0-preview6.19280.2 - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-preview6.19280.2 * Expose, test, and use Environment.TickCount64 * Back out change to WinInetProxyHelper.cs
1 parent 50727e4 commit 06f25ea

File tree

10 files changed

+49
-43
lines changed

10 files changed

+49
-43
lines changed

eng/Version.Details.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<Dependency Name="Microsoft.NETCore.Runtime.CoreCLR" Version="3.0.0-preview6.19279.4">
3+
<Dependency Name="Microsoft.NETCore.Runtime.CoreCLR" Version="3.0.0-preview6.19280.2">
44
<Uri>https://github.com/dotnet/coreclr</Uri>
5-
<Sha>42d8e40e469cf00128e0cfa48f24297afa13c36f</Sha>
5+
<Sha>fa8383fb28be945cae900a5579afd5920f274fd4</Sha>
66
</Dependency>
7-
<Dependency Name="Microsoft.NETCore.ILAsm" Version="3.0.0-preview6.19279.4">
7+
<Dependency Name="Microsoft.NETCore.ILAsm" Version="3.0.0-preview6.19280.2">
88
<Uri>https://github.com/dotnet/coreclr</Uri>
9-
<Sha>42d8e40e469cf00128e0cfa48f24297afa13c36f</Sha>
9+
<Sha>fa8383fb28be945cae900a5579afd5920f274fd4</Sha>
1010
</Dependency>
11-
<Dependency Name="Microsoft.NET.Sdk.IL" Version="3.0.0-preview6.19279.4">
11+
<Dependency Name="Microsoft.NET.Sdk.IL" Version="3.0.0-preview6.19280.2">
1212
<Uri>https://github.com/dotnet/coreclr</Uri>
13-
<Sha>42d8e40e469cf00128e0cfa48f24297afa13c36f</Sha>
13+
<Sha>fa8383fb28be945cae900a5579afd5920f274fd4</Sha>
1414
</Dependency>
1515
</ProductDependencies>
1616
<ToolsetDependencies>

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
<MicrosoftNETCoreDotNetHostPackageVersion>3.0.0-preview6-27730-01</MicrosoftNETCoreDotNetHostPackageVersion>
4141
<MicrosoftNETCoreDotNetHostPolicyPackageVersion>3.0.0-preview6-27730-01</MicrosoftNETCoreDotNetHostPolicyPackageVersion>
4242
<!-- Coreclr dependencies -->
43-
<MicrosoftNETCoreILAsmPackageVersion>3.0.0-preview6.19279.4</MicrosoftNETCoreILAsmPackageVersion>
44-
<MicrosoftNETCoreRuntimeCoreCLRPackageVersion>3.0.0-preview6.19279.4</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
43+
<MicrosoftNETCoreILAsmPackageVersion>3.0.0-preview6.19280.2</MicrosoftNETCoreILAsmPackageVersion>
44+
<MicrosoftNETCoreRuntimeCoreCLRPackageVersion>3.0.0-preview6.19280.2</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
4545
<!-- Corefx dependencies -->
4646
<MicrosoftNETCorePlatformsPackageVersion>3.0.0-preview6.19281.1</MicrosoftNETCorePlatformsPackageVersion>
4747
<runtimenativeSystemIOPortsPackageVersion>4.6.0-preview6.19281.1</runtimenativeSystemIOPortsPackageVersion>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19280.2",
77
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19280.2",
88
"FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0",
9-
"Microsoft.NET.Sdk.IL": "3.0.0-preview6.19279.4"
9+
"Microsoft.NET.Sdk.IL": "3.0.0-preview6.19280.2"
1010
}
1111
}

src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinInetProxyHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,4 @@ public bool GetProxyForUrl(
179179
return useProxy;
180180
}
181181
}
182-
}
182+
}

src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal sealed partial class Http2Connection : HttpConnectionBase, IDisposable
4141
private int _initialWindowSize;
4242
private int _maxConcurrentStreams;
4343
private int _pendingWindowUpdate;
44-
private int _idleSinceTickCount;
44+
private long _idleSinceTickCount;
4545
private int _pendingWriters;
4646

4747
private bool _disposed;
@@ -1138,7 +1138,7 @@ private void Abort(Exception abortException)
11381138
}
11391139

11401140
/// <summary>Gets whether the connection exceeded any of the connection limits.</summary>
1141-
/// <param name="nowTicks">The current tick count. Passed in to amortize the cost of calling Environment.TickCount.</param>
1141+
/// <param name="nowTicks">The current tick count. Passed in to amortize the cost of calling Environment.TickCount64.</param>
11421142
/// <param name="connectionLifetime">How long a connection can be open to be considered reusable.</param>
11431143
/// <param name="connectionIdleTimeout">How long a connection can have been idle in the pool to be considered reusable.</param>
11441144
/// <returns>
@@ -1149,7 +1149,7 @@ private void Abort(Exception abortException)
11491149
/// the nature of connection pooling.
11501150
/// </returns>
11511151

1152-
public bool IsExpired(int nowTicks,
1152+
public bool IsExpired(long nowTicks,
11531153
TimeSpan connectionLifetime,
11541154
TimeSpan connectionIdleTimeout)
11551155

@@ -1162,9 +1162,9 @@ public bool IsExpired(int nowTicks,
11621162
// Check idle timeout when there are not pending requests for a while.
11631163
if ((connectionIdleTimeout != Timeout.InfiniteTimeSpan) &&
11641164
(_httpStreams.Count == 0) &&
1165-
((uint)(nowTicks - _idleSinceTickCount) > connectionIdleTimeout.TotalMilliseconds))
1165+
((nowTicks - _idleSinceTickCount) > connectionIdleTimeout.TotalMilliseconds))
11661166
{
1167-
if (NetEventSource.IsEnabled) Trace($"Connection no longer usable. Idle {TimeSpan.FromMilliseconds((uint)(nowTicks - _idleSinceTickCount))} > {connectionIdleTimeout}.");
1167+
if (NetEventSource.IsEnabled) Trace($"Connection no longer usable. Idle {TimeSpan.FromMilliseconds((nowTicks - _idleSinceTickCount))} > {connectionIdleTimeout}.");
11681168

11691169
return true;
11701170
}
@@ -1448,7 +1448,7 @@ private void RemoveStream(Http2Stream http2Stream)
14481448
if (_httpStreams.Count == 0)
14491449
{
14501450
// If this was last pending request, get timestamp so we can monitor idle time.
1451-
_idleSinceTickCount = Environment.TickCount;
1451+
_idleSinceTickCount = Environment.TickCount64;
14521452
}
14531453

14541454
if (_disposed)

src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ internal abstract class HttpConnectionBase
1212
public abstract Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken);
1313
internal abstract void Trace(string message, string memberName = null);
1414

15-
private int CreationTickCount { get; } = Environment.TickCount;
15+
private long CreationTickCount { get; } = Environment.TickCount64;
1616

1717
// Check if lifetime expired on connection.
18-
public bool LifetimeExpired(int nowTicks, TimeSpan lifetime)
18+
public bool LifetimeExpired(long nowTicks, TimeSpan lifetime)
1919
{
2020
bool expired =
2121
lifetime != Timeout.InfiniteTimeSpan &&
22-
(lifetime == TimeSpan.Zero || (uint)(nowTicks - CreationTickCount) > lifetime.TotalMilliseconds);
22+
(lifetime == TimeSpan.Zero || (nowTicks - CreationTickCount) > lifetime.TotalMilliseconds);
2323

24-
if (expired && NetEventSource.IsEnabled) Trace($"Connection no longer usable. Alive {TimeSpan.FromMilliseconds((uint)(nowTicks - CreationTickCount))} > {lifetime}.");
24+
if (expired && NetEventSource.IsEnabled) Trace($"Connection no longer usable. Alive {TimeSpan.FromMilliseconds((nowTicks - CreationTickCount))} > {lifetime}.");
2525
return expired;
2626
}
2727
}

src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private ValueTask<HttpConnection> GetOrReserveHttp11ConnectionAsync(Cancellation
229229

230230
TimeSpan pooledConnectionLifetime = _poolManager.Settings._pooledConnectionLifetime;
231231
TimeSpan pooledConnectionIdleTimeout = _poolManager.Settings._pooledConnectionIdleTimeout;
232-
int nowTicks = Environment.TickCount;
232+
long nowTicks = Environment.TickCount64;
233233
List<CachedConnection> list = _idleConnections;
234234

235235
// Try to find a usable cached connection.
@@ -340,7 +340,7 @@ private ValueTask<HttpConnection> GetOrReserveHttp11ConnectionAsync(Cancellation
340340
if (http2Connection != null)
341341
{
342342
TimeSpan pooledConnectionLifetime = _poolManager.Settings._pooledConnectionLifetime;
343-
if (http2Connection.LifetimeExpired(Environment.TickCount, pooledConnectionLifetime))
343+
if (http2Connection.LifetimeExpired(Environment.TickCount64, pooledConnectionLifetime))
344344
{
345345
// Connection expired.
346346
http2Connection.Dispose();
@@ -797,7 +797,7 @@ public void DecrementConnectionCount()
797797
/// <param name="connection">The connection to return.</param>
798798
public void ReturnConnection(HttpConnection connection)
799799
{
800-
bool lifetimeExpired = connection.LifetimeExpired(Environment.TickCount, _poolManager.Settings._pooledConnectionLifetime);
800+
bool lifetimeExpired = connection.LifetimeExpired(Environment.TickCount64, _poolManager.Settings._pooledConnectionLifetime);
801801

802802
if (!lifetimeExpired)
803803
{
@@ -915,7 +915,7 @@ public bool CleanCacheAndDisposeIfUnused()
915915

916916
// Get the current time. This is compared against each connection's last returned
917917
// time to determine whether a connection is too old and should be closed.
918-
int nowTicks = Environment.TickCount;
918+
long nowTicks = Environment.TickCount64;
919919
Http2Connection http2Connection = _http2Connection;
920920

921921
if (http2Connection != null)
@@ -1039,15 +1039,15 @@ private void Trace(string message, [CallerMemberName] string memberName = null)
10391039
/// <summary>The cached connection.</summary>
10401040
internal readonly HttpConnection _connection;
10411041
/// <summary>The last tick count at which the connection was used.</summary>
1042-
internal readonly int _returnedTickCount;
1042+
internal readonly long _returnedTickCount;
10431043

10441044
/// <summary>Initializes the cached connection and its associated metadata.</summary>
10451045
/// <param name="connection">The connection.</param>
10461046
public CachedConnection(HttpConnection connection)
10471047
{
10481048
Debug.Assert(connection != null);
10491049
_connection = connection;
1050-
_returnedTickCount = Environment.TickCount;
1050+
_returnedTickCount = Environment.TickCount64;
10511051
}
10521052

10531053
/// <summary>Gets whether the connection is currently usable.</summary>
@@ -1062,16 +1062,16 @@ public CachedConnection(HttpConnection connection)
10621062
/// the nature of connection pooling.
10631063
/// </returns>
10641064
public bool IsUsable(
1065-
int nowTicks,
1065+
long nowTicks,
10661066
TimeSpan pooledConnectionLifetime,
10671067
TimeSpan pooledConnectionIdleTimeout,
10681068
bool poll = false)
10691069
{
10701070
// Validate that the connection hasn't been idle in the pool for longer than is allowed.
10711071
if ((pooledConnectionIdleTimeout != Timeout.InfiniteTimeSpan) &&
1072-
((uint)(nowTicks - _returnedTickCount) > pooledConnectionIdleTimeout.TotalMilliseconds))
1072+
((nowTicks - _returnedTickCount) > pooledConnectionIdleTimeout.TotalMilliseconds))
10731073
{
1074-
if (NetEventSource.IsEnabled) _connection.Trace($"Connection no longer usable. Idle {TimeSpan.FromMilliseconds((uint)(nowTicks - _returnedTickCount))} > {pooledConnectionIdleTimeout}.");
1074+
if (NetEventSource.IsEnabled) _connection.Trace($"Connection no longer usable. Idle {TimeSpan.FromMilliseconds((nowTicks - _returnedTickCount))} > {pooledConnectionIdleTimeout}.");
10751075
return false;
10761076
}
10771077

src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionSettings.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ public HttpConnectionSettings CloneAndNormalize()
6464
_cookieContainer = new CookieContainer();
6565
}
6666

67-
// The implementation uses Environment.TickCount to track connection lifetimes, as Environment.TickCount
68-
// is measurable faster than DateTime.UtcNow / Stopwatch.GetTimestamp, and we do it at least once per request.
69-
// However, besides its lower resolution (which is fine for SocketHttpHandler's needs), due to being based on
70-
// an Int32 rather than Int64, the difference between two tick counts is at most ~49 days. This means that
71-
// specifying a connection idle or lifetime of greater than 49 days would cause it to never be reached. The
72-
// chances of a connection being open anywhere near that long is close to zero, as is the chance that someone
73-
// would choose to specify such a long timeout, but regardless, we avoid issues by capping the timeouts.
74-
TimeSpan timeLimit = TimeSpan.FromDays(40); // something super long but significantly less than the 49 day limit
75-
TimeSpan pooledConnectionLifetime = _pooledConnectionLifetime < timeLimit ? _pooledConnectionLifetime : timeLimit;
76-
TimeSpan pooledConnectionIdleTimeout = _pooledConnectionIdleTimeout < timeLimit ? _pooledConnectionIdleTimeout : timeLimit;
77-
7867
return new HttpConnectionSettings()
7968
{
8069
_allowAutoRedirect = _allowAutoRedirect,
@@ -90,8 +79,8 @@ public HttpConnectionSettings CloneAndNormalize()
9079
_maxResponseDrainSize = _maxResponseDrainSize,
9180
_maxResponseDrainTime = _maxResponseDrainTime,
9281
_maxResponseHeadersLength = _maxResponseHeadersLength,
93-
_pooledConnectionLifetime = pooledConnectionLifetime,
94-
_pooledConnectionIdleTimeout = pooledConnectionIdleTimeout,
82+
_pooledConnectionLifetime = _pooledConnectionLifetime,
83+
_pooledConnectionIdleTimeout = _pooledConnectionIdleTimeout,
9584
_preAuthenticate = _preAuthenticate,
9685
_properties = _properties,
9786
_proxy = _proxy,

src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ public static partial class Environment
670670
public static string SystemDirectory { get { throw null; } }
671671
public static int SystemPageSize { get { throw null; } }
672672
public static int TickCount { get { throw null; } }
673+
public static long TickCount64 { get { throw null; } }
673674
public static string UserDomainName { get { throw null; } }
674675
public static bool UserInteractive { get { throw null; } }
675676
public static string UserName { get { throw null; } }

src/System.Runtime.Extensions/tests/System/Environment.TickCount.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class EnvironmentTickCount
1515
public void TickCountTest()
1616
{
1717
int start = Environment.TickCount;
18-
HashSet<int> times = new HashSet<int>();
18+
var times = new HashSet<int>();
1919
Func<bool> test = () =>
2020
{
2121
int time = Environment.TickCount;
@@ -26,5 +26,21 @@ public void TickCountTest()
2626
SpinWait.SpinUntil(test, TimeSpan.FromSeconds(1)) || test(),
2727
$"TickCount did not increase after one second. start: {start}, values tested: {string.Join(", ", times.ToArray())}.");
2828
}
29+
30+
[Fact]
31+
public void TickCount64Test()
32+
{
33+
long start = Environment.TickCount64;
34+
var times = new HashSet<long>();
35+
Func<bool> test = () =>
36+
{
37+
long time = Environment.TickCount64;
38+
times.Add(time);
39+
return time - start > 0;
40+
};
41+
Assert.True(
42+
SpinWait.SpinUntil(test, TimeSpan.FromSeconds(1)) || test(),
43+
$"TickCount did not increase after one second. start: {start}, values tested: {string.Join(", ", times.ToArray())}.");
44+
}
2945
}
3046
}

0 commit comments

Comments
 (0)