-
Notifications
You must be signed in to change notification settings - Fork 7
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: don't panic on invalid roll
strategy, and update an error message
#33
fix: don't panic on invalid roll
strategy, and update an error message
#33
Conversation
2710f71
to
5519613
Compare
thanks @alexander-beedie ! I'm seeing a really mysterious segmentation fault in CI, have no idea what's causing that, any ideas?
|
I just added a test and it all started blowing up 🤣 |
😆 it's so odd...it only appears when running the full test suite via pytest if I
Don't even know how to investigate this 🤷 |
d3f25e4
to
61273e4
Compare
Reworked it slightly to trap/test earlier (and raise an even better error) at the Python level, keeping the lower level Rust-side bail in case there are any other ways of getting there 🤔 |
What is the output of valgrind? |
I've tried running it, but I've not used valgrind before so don't know how to interpet it, will take a look
|
4f43d47
to
06aa7a1
Compare
This seems the culprint: ==23654== Thread 22:
==23654== Conditional jump or move depends on uninitialised value(s)
==23654== at 0xD725963: <regex_syntax::hir::translate::TranslatorI as regex_syntax::ast::visitor::Visitor>::visit_post (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xD6C415F: regex_automata::meta::regex::Builder::build (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xD6A3D0C: regex::builders::string::RegexBuilder::build (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xD6A6007: regex::regex::string::Regex::new (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xD342055: polars_plan::dsl::function_expr::strings::replace (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xD33FFCE: <F as polars_plan::dsl::expr_dyn_fn::SeriesUdf>::call_udf (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xC7BB761: polars_lazy::physical_plan::expressions::apply::ApplyExpr::eval_and_flatten (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xC7B2EA3: <polars_lazy::physical_plan::expressions::apply::ApplyExpr as polars_lazy::physical_plan::expressions::PhysicalExpr>::evaluate (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xC7C3ABD: rayon::iter::plumbing::bridge_producer_consumer::helper (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xC7C465C: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xA878FA8: rayon_core::registry::WorkerThread::wait_until_cold (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so)
==23654== by 0xD6A0DE6: std::sys_common::backtrace::__rust_begin_short_backtrace (in /home/marcogorelli/pyo3-polars-dev/polars_business/venv/lib/python3.10/site-packages/polars/polars.abi3.so) |
All good now? |
all good by working around it by doing the check in Python 😆 : if roll not in (valid_roll_strategies := get_args(RollStrategy)):
allowed = ", ".join(repr(m) for m in valid_roll_strategies)
raise ValueError(
f"`roll` strategy must be one of {{{allowed}}}, got {roll!r}"
) Removing that, and letting the error be raised from within Rust, and the segfault still appears Going to merge and release for now, as the error doesn't seem related to this PR itself if the culprit is n = (by.str.extract(r"^(-?)") + by.str.extract(r"(\d+)bd")).cast(pl.Int32)
by = by.str.replace(r"(\d+bd)", "") (but even then, I don't see what's uninitialised) thanks @alexander-beedie for the PR and @ritchie46 for taking a look! I've opened #34 to make sure the issue isn't forgotten |
Should close #32 ✌️