<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/go-git.git/src/context, branch dev.cmdgo</title>
<subtitle>github.com: golang/go
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/'/>
<entry>
<title>all: fix spellings</title>
<updated>2021-04-10T01:46:41+00:00</updated>
<author>
<name>Naman Gera</name>
<email>namangera15@gmail.com</email>
</author>
<published>2021-04-09T03:48:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=52bf14e0e8bdcd73f1ddfb0c4a1d0200097d3ba2'/>
<id>52bf14e0e8bdcd73f1ddfb0c4a1d0200097d3ba2</id>
<content type='text'>
This follows the spelling choices that the Go project has made for English words.
https://github.com/golang/go/wiki/Spelling

Change-Id: Ie7c586d2cf23020cb492cfff58c0831d2d8d3a78
GitHub-Last-Rev: e16a32cd225a275f73d236bcb33703986d110ded
GitHub-Pull-Request: golang/go#45442
Reviewed-on: https://go-review.googlesource.com/c/go/+/308291
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This follows the spelling choices that the Go project has made for English words.
https://github.com/golang/go/wiki/Spelling

Change-Id: Ie7c586d2cf23020cb492cfff58c0831d2d8d3a78
GitHub-Last-Rev: e16a32cd225a275f73d236bcb33703986d110ded
GitHub-Pull-Request: golang/go#45442
Reviewed-on: https://go-review.googlesource.com/c/go/+/308291
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: avoid importing context package twice</title>
<updated>2021-02-24T18:15:00+00:00</updated>
<author>
<name>Kevin Burke</name>
<email>kev@inburke.com</email>
</author>
<published>2021-02-24T17:12:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=c9d9b40b1355a8e6674aaaf6abaf362e66abae47'/>
<id>c9d9b40b1355a8e6674aaaf6abaf362e66abae47</id>
<content type='text'>
Change-Id: Id0a127e080dda8ee62738922c6de8caf3719dd68
Reviewed-on: https://go-review.googlesource.com/c/go/+/295949
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Trust: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Trust: Kevin Burke &lt;kev@inburke.com&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: Id0a127e080dda8ee62738922c6de8caf3719dd68
Reviewed-on: https://go-review.googlesource.com/c/go/+/295949
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Trust: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Trust: Kevin Burke &lt;kev@inburke.com&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: reduce contention in cancelCtx.Done</title>
<updated>2021-02-24T16:38:32+00:00</updated>
<author>
<name>Josh Bleecher Snyder</name>
<email>josharian@gmail.com</email>
</author>
<published>2021-01-29T23:41:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=ae1fa08e4138c49c8e7fa10c3eadbfca0233842b'/>
<id>ae1fa08e4138c49c8e7fa10c3eadbfca0233842b</id>
<content type='text'>
Use an atomic.Value to hold the done channel.
Conveniently, we have a mutex handy to coordinate writes to it.

name                 old time/op  new time/op  delta
ContextCancelDone-8  67.5ns ±10%   2.2ns ±11%  -96.74%  (p=0.000 n=30+28)

Fixes #42564

Change-Id: I5d72e0e87fb221d4e230209e5fb4698bea4053c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/288193
Trust: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Trust: Sameer Ajmani &lt;sameer@golang.org&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Bryan C. Mills &lt;bcmills@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use an atomic.Value to hold the done channel.
Conveniently, we have a mutex handy to coordinate writes to it.

name                 old time/op  new time/op  delta
ContextCancelDone-8  67.5ns ±10%   2.2ns ±11%  -96.74%  (p=0.000 n=30+28)

Fixes #42564

Change-Id: I5d72e0e87fb221d4e230209e5fb4698bea4053c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/288193
Trust: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Trust: Sameer Ajmani &lt;sameer@golang.org&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Bryan C. Mills &lt;bcmills@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: fix XTestInterlockedCancels</title>
<updated>2021-02-23T22:54:59+00:00</updated>
<author>
<name>Keiichi Hirobe</name>
<email>chalenge.akane@gmail.com</email>
</author>
<published>2021-02-21T03:22:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=42b9e3a8dfb31f18829c45f0995cbf3c78fc90fb'/>
<id>42b9e3a8dfb31f18829c45f0995cbf3c78fc90fb</id>
<content type='text'>
The test does not use Done channel, so fix that.

Change-Id: I795feab2e95de815b8b6ee7a7fd90f19f7af7db1
Reviewed-on: https://go-review.googlesource.com/c/go/+/294749
Reviewed-by: Sameer Ajmani &lt;sameer@golang.org&gt;
Trust: Sameer Ajmani &lt;sameer@golang.org&gt;
Trust: Cody Oss &lt;codyoss@google.com&gt;
Run-TryBot: Sameer Ajmani &lt;sameer@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The test does not use Done channel, so fix that.

Change-Id: I795feab2e95de815b8b6ee7a7fd90f19f7af7db1
Reviewed-on: https://go-review.googlesource.com/c/go/+/294749
Reviewed-by: Sameer Ajmani &lt;sameer@golang.org&gt;
Trust: Sameer Ajmani &lt;sameer@golang.org&gt;
Trust: Cody Oss &lt;codyoss@google.com&gt;
Run-TryBot: Sameer Ajmani &lt;sameer@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: fix a flaky timeout in TestLayersTimeout</title>
<updated>2020-03-31T17:59:03+00:00</updated>
<author>
<name>Bryan C. Mills</name>
<email>bcmills@google.com</email>
</author>
<published>2020-03-30T18:04:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=5d2ddcd3f51c1ff7aa0a84604b1d8610a17a7933'/>
<id>5d2ddcd3f51c1ff7aa0a84604b1d8610a17a7933</id>
<content type='text'>
In CL 223019, I reduced the short timeout in the testLayers helper to
be even shorter than it was. That exposed a racy (time-dependent)
select later in the function, which failed in one of the slower
builders (android-386-emu).

Also streamline the test to make it easier to test with a very high -count flag:
- Run tests that sleep for shortDuration in parallel to reduce latency.
- Use shorter durations in examples to reduce test running time.
- Avoid mutating global state (in package math/rand) in testLayers.

After this change (but not before it),
'go test -run=TestLayersTimeout -count=100000 context' passes on my workstation.

Fixes #38161

Change-Id: Iaf4abe7ac308b2100d8828267cda9f4f8ae4be82
Reviewed-on: https://go-review.googlesource.com/c/go/+/226457
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In CL 223019, I reduced the short timeout in the testLayers helper to
be even shorter than it was. That exposed a racy (time-dependent)
select later in the function, which failed in one of the slower
builders (android-386-emu).

Also streamline the test to make it easier to test with a very high -count flag:
- Run tests that sleep for shortDuration in parallel to reduce latency.
- Use shorter durations in examples to reduce test running time.
- Avoid mutating global state (in package math/rand) in testLayers.

After this change (but not before it),
'go test -run=TestLayersTimeout -count=100000 context' passes on my workstation.

Fixes #38161

Change-Id: Iaf4abe7ac308b2100d8828267cda9f4f8ae4be82
Reviewed-on: https://go-review.googlesource.com/c/go/+/226457
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: prevent creation of invalid contexts</title>
<updated>2020-03-18T19:44:13+00:00</updated>
<author>
<name>Kyle Nusbaum</name>
<email>kyle@datadog.com</email>
</author>
<published>2020-03-18T19:17:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=02057906f7272a4787b8a0b5b7cafff8ad3024f0'/>
<id>02057906f7272a4787b8a0b5b7cafff8ad3024f0</id>
<content type='text'>
This commit makes it impossible to create derived contexts with nil parents.
Previously it was possible to create derived contexts with nil parents, and
invalid contexts could propogate through the program. Eventually this can
cause a panic downstream, which is difficult to trace back to the source
of the error.

Although `WithCancel` and `WithDeadline` already panic if `parent` is `nil`, this adds explicit checks to give a useful message in the panic.

Fixes #37908

Change-Id: I70fd01f6539c1b0da0e775fc5457e32e7075e52c
GitHub-Last-Rev: 1b7dadd7db9ba42952644ad5e9a49591d6a5191f
GitHub-Pull-Request: golang/go#37898
Reviewed-on: https://go-review.googlesource.com/c/go/+/223777
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit makes it impossible to create derived contexts with nil parents.
Previously it was possible to create derived contexts with nil parents, and
invalid contexts could propogate through the program. Eventually this can
cause a panic downstream, which is difficult to trace back to the source
of the error.

Although `WithCancel` and `WithDeadline` already panic if `parent` is `nil`, this adds explicit checks to give a useful message in the panic.

Fixes #37908

Change-Id: I70fd01f6539c1b0da0e775fc5457e32e7075e52c
GitHub-Last-Rev: 1b7dadd7db9ba42952644ad5e9a49591d6a5191f
GitHub-Pull-Request: golang/go#37898
Reviewed-on: https://go-review.googlesource.com/c/go/+/223777
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: deflake time-sensitive tests</title>
<updated>2020-03-13T22:25:52+00:00</updated>
<author>
<name>Bryan C. Mills</name>
<email>bcmills@google.com</email>
</author>
<published>2020-03-11T19:14:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=e8ecda8a38a1705d2ead985743f287acad34b542'/>
<id>e8ecda8a38a1705d2ead985743f287acad34b542</id>
<content type='text'>
Many of tests in this package assumed reasonable scheduling latency.
Unfortunately, scheduling latency on builders and CI systems is not
always reasonable.

Rather than expecting that a timeout is detected within a fixed short
interval, we can use (*testing.T).Deadline to portably scale the time
we're willing to wait to something appropriate to the builder.

Some of the tests also included arbitrary-duration sleeps, which are
no longer needed after CL 196521; we can remove those instead of
extending them.

Promptness of timeouts is also an important property, but testing that
property is better suited to benchmarks than to tests proper: unlike
tests, we generally expect benchmarks to be run in a quiet,
low-contention environment.

Fixes #13956

Change-Id: I0797e2267fb778c8ad94add56d797de9e2c885e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/223019
Run-TryBot: Bryan C. Mills &lt;bcmills@google.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Many of tests in this package assumed reasonable scheduling latency.
Unfortunately, scheduling latency on builders and CI systems is not
always reasonable.

Rather than expecting that a timeout is detected within a fixed short
interval, we can use (*testing.T).Deadline to portably scale the time
we're willing to wait to something appropriate to the builder.

Some of the tests also included arbitrary-duration sleeps, which are
no longer needed after CL 196521; we can remove those instead of
extending them.

Promptness of timeouts is also an important property, but testing that
property is better suited to benchmarks than to tests proper: unlike
tests, we generally expect benchmarks to be run in a quiet,
low-contention environment.

Fixes #13956

Change-Id: I0797e2267fb778c8ad94add56d797de9e2c885e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/223019
Run-TryBot: Bryan C. Mills &lt;bcmills@google.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: mark testDeadline as a testing helper method</title>
<updated>2019-10-29T14:22:15+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2019-10-29T13:39:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=a0c1e8d1ab07068e14b5abcd02099dbfb932188b'/>
<id>a0c1e8d1ab07068e14b5abcd02099dbfb932188b</id>
<content type='text'>
Change-Id: Ie6fc3e9789aea6e5949e66186db6f2b071b6fdff
Reviewed-on: https://go-review.googlesource.com/c/go/+/204037
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: Ie6fc3e9789aea6e5949e66186db6f2b071b6fdff
Reviewed-on: https://go-review.googlesource.com/c/go/+/204037
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: use fewer goroutines in WithCancel/WithTimeout</title>
<updated>2019-09-26T16:25:30+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2019-09-19T19:33:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=0ad368675bae1e3228c9146e092cd00cfb29ac27'/>
<id>0ad368675bae1e3228c9146e092cd00cfb29ac27</id>
<content type='text'>
If the parent context passed to WithCancel or WithTimeout
is a known context implementation (one created by this package),
we attach the child to the parent by editing data structures directly;
otherwise, for unknown parent implementations, we make a
goroutine that watches for the parent to finish and propagates
the cancellation.

A common problem with this scheme, before this CL, is that
users who write custom context implementations to manage
their value sets cause WithCancel/WithTimeout to start
goroutines that would have not been started before.

This CL changes the way we map a parent context back to the
underlying data structure. Instead of walking up through
known context implementations to reach the *cancelCtx,
we look up parent.Value(&amp;cancelCtxKey) to return the
innermost *cancelCtx, which we use if it matches parent.Done().

This way, a custom context implementation wrapping a
*cancelCtx but not changing Done-ness (and not refusing
to return wrapped keys) will not require a goroutine anymore
in WithCancel/WithTimeout.

For #28728.

Change-Id: Idba2f435c81b19fe38d0dbf308458ca87c7381e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/196521
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the parent context passed to WithCancel or WithTimeout
is a known context implementation (one created by this package),
we attach the child to the parent by editing data structures directly;
otherwise, for unknown parent implementations, we make a
goroutine that watches for the parent to finish and propagates
the cancellation.

A common problem with this scheme, before this CL, is that
users who write custom context implementations to manage
their value sets cause WithCancel/WithTimeout to start
goroutines that would have not been started before.

This CL changes the way we map a parent context back to the
underlying data structure. Instead of walking up through
known context implementations to reach the *cancelCtx,
we look up parent.Value(&amp;cancelCtxKey) to return the
innermost *cancelCtx, which we use if it matches parent.Done().

This way, a custom context implementation wrapping a
*cancelCtx but not changing Done-ness (and not refusing
to return wrapped keys) will not require a goroutine anymore
in WithCancel/WithTimeout.

For #28728.

Change-Id: Idba2f435c81b19fe38d0dbf308458ca87c7381e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/196521
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>context: mention asynchronous cancellation propagation</title>
<updated>2019-09-18T19:24:59+00:00</updated>
<author>
<name>Egon Elbre</name>
<email>egonelbre@gmail.com</email>
</author>
<published>2019-07-30T07:02:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=90f9426573e80bb072c80d7bf9fe3abd6d9a81ce'/>
<id>90f9426573e80bb072c80d7bf9fe3abd6d9a81ce</id>
<content type='text'>
Fixes #33185

Change-Id: I0adcffa5d1c9e55ae52309c59f961b0710166098
Reviewed-on: https://go-review.googlesource.com/c/go/+/187921
Reviewed-by: Sameer Ajmani &lt;sameer@golang.org&gt;
Run-TryBot: Sameer Ajmani &lt;sameer@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #33185

Change-Id: I0adcffa5d1c9e55ae52309c59f961b0710166098
Reviewed-on: https://go-review.googlesource.com/c/go/+/187921
Reviewed-by: Sameer Ajmani &lt;sameer@golang.org&gt;
Run-TryBot: Sameer Ajmani &lt;sameer@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
