-
-
Notifications
You must be signed in to change notification settings - Fork 366
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 index-out-of-bounds line glyph crash and run select tests with JIT disabled #683
Conversation
With jit disabled, this combination of x_range, y_range, width, height, and line coordinates results in an index out of bounds exception. With jit enabled, this results in a non-deterministic segmentation fault.
The crash in GH 570 resulted from: y_mapper(ymax) * sy + ty == 299.99999999999994 the `int` constructor truncates this down to 299, but we need it to be rounded to 300.
So happy to see this finally being fixed. |
Whew, that looks great! Yes, I'm very excited by the possibility that this is fixed, plus the new non-Numba tests that should help detect similar issues in the future. Can you please look at #259 and see if there are any tests that ensure that these changes don't cause a return to the original problem described there? If so, then this seems ready to merge; if not, then please add such tests. |
Perfect, thanks! |
This PR closes #570 and #646
Based on the helpful debugging of @bardiche98 and @p3trus, I was able to construct a small test case that reproduces the conditions of the crash reported in #570 (See
4f7ae29 and the
test_bug_570
test indatashader/tests/test_pandas.py
).As discussed in #570, this did turn out to be an index-out-of-bounds error. But since numba JIT-compiled code does not perform array bounds checking, this resulted in a non-deterministic kernel crash.
To more reliably reproduce and diagnose the issue, I made a few small changes to allow Datashader to operate with the numba jit compilation disabled (See ae920da).
I also added a new tox test configuration to run a subset of the Datashader unit tests with JIT compilation disabled (See 4219fba). With JIT compilation disabled (and without the fix described below),
test_bug_570
reliably raises anIndexError
and does not crash the kernel.Finally, I actually fixed #570 in 105d766 by changing
int
toround
in this section of the line glyph'smap_onto_pixel
function:In this particular test case, the canvas is 300 pixels in height, so we want
yymax
to end up as 300. But due to numerical precision subtletiesy_mapper(ymax) * sy + ty == 299.99999999999994
and soint(y_mapper(ymax) * sy + ty) == 299
andyymax
gets set to 299. By changing this toround
,yymax
ends up as 300 as it should.Note: Waiting on #682 for travis test fixes