-
Notifications
You must be signed in to change notification settings - Fork 445
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
no_stack_overflow_on_drop tests fail on FreeBSD #967
Comments
This test works by spinning up a thread with an atypically small stack size, parsing a regex into an Ast and then dropping it. We use a small stack size such that *if the Ast didn't have a custom Drop impl*, then its default recursive Drop impl would overflow the stack. (If we don't use a smaller stack size, then the default on some platforms is usually quite large and might require a much larger Ast to provoke a failure.) It turns out that the stack size we were using was quite tiny, and too tiny for some platforms such as FreeBSD. We therefore increase it a little bit, but not too much. We do the same for the corresponding test for the custom Drop impl for Hir. Fixes #967
Hmmm. The test is definitely not particularly robust. The problem with choosing a large stack size is that you also then have to build a bigger expression. For example, on my (Linux) system, the test passes:
But that isn't quite the point of the test. Because the test also depends on the fact that if you remove the custom
So okay, I bumped the stack size to 8K and the test does indeed still fail. I then bumped it to 16K and the test still fails. Since that feels comfortably above the minimum that worked for you, I think that sounds okay to me? (It actually fails with 31K too, but not with 32K. So 16K seems like a good number.) I put #968 up to fix this (including the corresponding test for |
Also, can I just say, I'm so fucking excited for Cranelift. It is amazing how far y'all are! |
This test works by spinning up a thread with an atypically small stack size, parsing a regex into an Ast and then dropping it. We use a small stack size such that *if the Ast didn't have a custom Drop impl*, then its default recursive Drop impl would overflow the stack. (If we don't use a smaller stack size, then the default on some platforms is usually quite large and might require a much larger Ast to provoke a failure.) It turns out that the stack size we were using was quite tiny, and too tiny for some platforms such as FreeBSD. We therefore increase it a little bit, but not too much. We do the same for the corresponding test for the custom Drop impl for Hir. Fixes #967
This is fixed in |
Thanks! Updated in bjorn3/rustc_codegen_cranelift@ae0a22c and confirmed that it works on FreeBSD. |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [regex](https://github.com/rust-lang/regex) | dependencies | patch | `1.7.1` -> `1.7.3` | --- ### Release Notes <details> <summary>rust-lang/regex</summary> ### [`v1.7.3`](https://github.com/rust-lang/regex/blob/HEAD/CHANGELOG.md#​173-2023-03-24) [Compare Source](rust-lang/regex@1.7.2...1.7.3) \================== This is a small release that fixes a bug in `Regex::shortest_match_at` that could cause it to panic, even when the offset given is valid. Bug fixes: - [BUG #​969](rust-lang/regex#969): Fix a bug in how the reverse DFA was called for `Regex::shortest_match_at`. ### [`v1.7.2`](https://github.com/rust-lang/regex/blob/HEAD/CHANGELOG.md#​172-2023-03-21) [Compare Source](rust-lang/regex@1.7.1...1.7.2) \================== This is a small release that fixes a failing test on FreeBSD. Bug fixes: - [BUG #​967](rust-lang/regex#967): Fix "no stack overflow" test which can fail due to the small stack size. </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 this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzUuNDAuMiJ9--> Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1827 Reviewed-by: crapStone <crapstone@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
What version of regex are you using?
a9b2e02
Describe the bug at a high level.
The no_stack_overflow_on_drop tests crash on FreeBSD with SIGBUS followed by SIGSEGV. This happens while spawning the thread. I am pretty sure it overflows the stack. 1k of stack seem to be way too little for spawning a thread on FreeBSD. The smallest stack size for which I was able to make it work is 8k. Anything below either crashes or hangs.
What are the steps to reproduce the behavior?
Run
cargo test -p regex-syntax
on FreeBSD.What is the actual behavior?
What is the expected behavior?
The test passes.
The text was updated successfully, but these errors were encountered: