Skip to content

util/contextutil: clarify RunWithTimeout error message#79767

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:runwithtimeout-message
Apr 11, 2022
Merged

util/contextutil: clarify RunWithTimeout error message#79767
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:runwithtimeout-message

Conversation

@erikgrinaker
Copy link
Copy Markdown
Contributor

RunWithTimeout gave an error message of this form:

operation "send-snapshot" timed out after 1m (took 1m): context deadline exceeded

However, this can be misleading because either the caller or callee can
set their own context timeout that is less than then one set by
RunWithTimeout, in which case it looks like:

operation "send-snapshot" timed out after 1m (took 1s): context deadline exceeded

This is even worse on old versions, where the "took 1s" is not included,
leading the reader to believe the operation actually took 1m when it
only took 1s.

This patch clarifies the error message somewhat:

operation "send-snapshot" timed out after 1s (given timeout 1m): context deadline exceeded

Resolves #79424.

Release note: None

@erikgrinaker erikgrinaker requested review from a team April 11, 2022 13:37
@erikgrinaker erikgrinaker self-assigned this Apr 11, 2022
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @erikgrinaker)

@erikgrinaker erikgrinaker force-pushed the runwithtimeout-message branch from b9f47ee to 8e4a7f8 Compare April 11, 2022 14:49
@erikgrinaker erikgrinaker requested review from a team and dt and removed request for a team April 11, 2022 14:49
`RunWithTimeout` gave an error message of this form:

```
operation "send-snapshot" timed out after 1m (took 1m): context deadline exceeded
```

However, this can be misleading because either the caller or callee can
set their own context timeout that is less than then one set by
`RunWithTimeout`, in which case it looks like:

```
operation "send-snapshot" timed out after 1m (took 1s): context deadline exceeded
```

This is even worse on old versions, where the "took 1s" is not included,
leading the reader to believe the operation actually took 1m when it
only took 1s.

This patch clarifies the error message somewhat:

```
operation "send-snapshot" timed out after 1s (given timeout 1m): context deadline exceeded
```

Release note: None
@erikgrinaker erikgrinaker force-pushed the runwithtimeout-message branch from 8e4a7f8 to f9e2bf3 Compare April 11, 2022 21:02
@erikgrinaker
Copy link
Copy Markdown
Contributor Author

TFTRs!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 11, 2022

Build succeeded:

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Apr 11, 2022

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from f9e2bf3 to blathers/backport-release-21.1-79767: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.1.x failed. See errors above.


error creating merge commit from f9e2bf3 to blathers/backport-release-21.2-79767: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

contextutil: RunWithTimeout error message is misleading

5 participants