Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix huge allocation for OffsetDateTime Arb without arguments #3491

Merged
merged 1 commit into from Apr 19, 2023

Conversation

rescribet
Copy link
Contributor

Using LocalDateTime.MIN and MAX cause a 2 billion, 8GB Int array to be allocated on each call. Resulting in OutOfMemoryExceptions on most systems.

Issue can be reproduced by changing the defaults back to the previous values and running the newly added tests.

This commit lets offsetDateTime and zonedDateTime use the same default as its sibling function localDateTime.

LocalDateTime.MIN and MAX cause a 2bn, 8GB array to be allocated on each call.
Resulting in OutOfMemoryExceptions on most systems.
@sksamuel sksamuel enabled auto-merge (squash) April 19, 2023 21:55
@sksamuel sksamuel merged commit ada9872 into kotest:master Apr 19, 2023
17 checks passed
nomisRev pushed a commit to arrow-kt/arrow-website that referenced this pull request May 11, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [io.kotest:kotest-runner-junit5](https://togithub.com/kotest/kotest) |
`5.6.1` -> `5.6.2` |
[![age](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-runner-junit5/5.6.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-runner-junit5/5.6.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-runner-junit5/5.6.2/compatibility-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-runner-junit5/5.6.2/confidence-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|
| [io.kotest:kotest-property](https://togithub.com/kotest/kotest) |
`5.6.1` -> `5.6.2` |
[![age](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-property/5.6.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-property/5.6.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-property/5.6.2/compatibility-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-property/5.6.2/confidence-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|
|
[io.kotest:kotest-framework-engine](https://togithub.com/kotest/kotest)
| `5.6.1` -> `5.6.2` |
[![age](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-framework-engine/5.6.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-framework-engine/5.6.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-framework-engine/5.6.2/compatibility-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-framework-engine/5.6.2/confidence-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|
| [io.kotest:kotest-assertions-core](https://togithub.com/kotest/kotest)
| `5.6.1` -> `5.6.2` |
[![age](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-assertions-core/5.6.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-assertions-core/5.6.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-assertions-core/5.6.2/compatibility-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/maven/io.kotest:kotest-assertions-core/5.6.2/confidence-slim/5.6.1)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>kotest/kotest</summary>

### [`v5.6.2`](https://togithub.com/kotest/kotest/releases/tag/v5.6.2)

##### 5.6.2 May 2023

##### Assertions

- Adding shouldHaveSameInstantAs matcher for OffsetDateTime. Fixes
[#&#8203;3488](https://togithub.com/kotest/kotest/issues/3488) by
[@&#8203;Kantis](https://togithub.com/Kantis) in
[kotest/kotest#3501

##### Property testing

- Fixes a problem with property testing on Apple platforms
[#&#8203;3506](https://togithub.com/kotest/kotest/issues/3506)
- Reverts behaviour of `Arb.string()` to only generate Strings of
printable ascii characters
- 5.6.0 changed it to include some control characters, see
[#&#8203;3513](https://togithub.com/kotest/kotest/issues/3513) for
details
- Fix huge allocation for OffsetDateTime Arb without arguments by
[@&#8203;rescribet](https://togithub.com/rescribet) in
[kotest/kotest#3491
- Fix Arb.map edgecases by
[@&#8203;myuwono](https://togithub.com/myuwono) in
[kotest/kotest#3496

##### Documentation

- Update writing_tests.md by
[@&#8203;erikhuizinga](https://togithub.com/erikhuizinga) in
[kotest/kotest#3497
- Update shouldBeEqualToComparingFields doc by
[@&#8203;ktrueda](https://togithub.com/ktrueda) in
[kotest/kotest#3416

##### Other

- Build Kotlin/Native library for ARM64 on Linux by
[@&#8203;charleskorn](https://togithub.com/charleskorn) in
[kotest/kotest#3521

##### ⚠️ Reverted behavior of `Arb.string()`

With Kotest 5.6.0, `Codepoint.ascii()` was changed to include a wider
range of ascii chararacters, and `Codepoint.printableAscii()` was
introduced with the historic range used by `Codepoint.ascii()`.

`Arb.string()` has been using `Codepoint.ascii()` as it's default for
generating chars for the string. This caused issues for some users, and
we decided to revert `Arb.string()` to the historic behavior by changing
the default to the new `Codepoint.printableAscii()`.

Hopefully this doesn't cause any issues for you. If it does, you can
revert to the 5.6.0 ~ 5.6.1 behavior by using `Codepoint.ascii()`
explicitly.

If you added explicit usage of `Codepoint.printableAscii()` to
circumvent the issue, you can safely remove the explicit parameter
starting with Kotest 5.6.2.

##### New Contributors

- [@&#8203;rescribet](https://togithub.com/rescribet) made their first
contribution in
[kotest/kotest#3491
- [@&#8203;ktrueda](https://togithub.com/ktrueda) made their first
contribution in
[kotest/kotest#3416
- [@&#8203;erikhuizinga](https://togithub.com/erikhuizinga) made their
first contribution in
[kotest/kotest#3497

**Full Changelog**:
kotest/kotest@v5.6.1...v5.6.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/arrow-kt/arrow-website).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS43NS4wIiwidXBkYXRlZEluVmVyIjoiMzUuNzUuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

None yet

2 participants