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

Exception in thread "ComparisonSorting", index 32768 out of bounds for length 32768 #110

Open
rylid-umil opened this issue Jul 13, 2024 · 5 comments

Comments

@rylid-umil
Copy link

When a sort ended on length 32768 length, the visual freezes, highlights and sound are frozen, but not cause of a freeze bug, it was beacuse it seemed when it tried to end the sort, the clear all marks bugged out.
image
I dont know why, but i didnt edit the highlight code, so it must be the same from my to your fork. It happens when i disable "End sweep anim", and when i am using a custom sort "Adaptive Sort" i made but not when i am using any other sorts. I do not get why it does not work, as if it was a mark index that was out of bounds (example Highlights.markArray(1, 32768) at 32768 length) it would've thrown an error at me, but it didn't. Yes, i tested importing my sort into your fork (with the added importation of MathExtra from the code) but it did not work.

@EmeraldBlock
Copy link
Collaborator

Please provide a clear step-by-step procedure of how to reproduce this, along with all files and code modifications you made. Otherwise, (1) we have literally no way to debug this, and (2) it could be that the issue is with the code you made.

@EmeraldBlock EmeraldBlock added the information requested Further information is requested label Jul 13, 2024
@rylid-umil
Copy link
Author

rylid-umil commented Jul 13, 2024

Step by step instruction to reproduce:

  1. Import AdaptiveSort.java (latest version) to the ArrayV.
  2. I made no changes to Highlights.java so i don't get how it will make an exception. (It also freezes when it reaches the end at length 4096 and probably other lengths but without the error (Unrelated but Flammer Sort also gives an error-thrown out of bounds for length 32768)
  3. Make sure to import MathExtra.java since Adaptive sort uses some of those functions.
  4. run the sort (recommended run on Randomly / Naiver randomly (slight shuffle but swaps N times) on 32768 length)
    5.when sort ends, it should freeze and the sounds should freeze as well and you probably be thrown an out of bounds exception not as an error but through the console. I tried with end sweep anim disabled and enabled
    Video of the issue:
2024-07-13.11-14-43.mp4

It seems to happen in the clearAllMarks function. SO maybe a highlight was placed at 32768? Or maybe the length 32768 is so long it bugs out sorts (like FlammerSort), but if a highlight was placed at 32768 (out of bounds) the Highlights.markArray(1, 32768); would've thrown an out of bounds error at me but it didn't. it was the clear all marks function.

@EmeraldBlock EmeraldBlock removed the information requested Further information is requested label Jul 13, 2024
@EmeraldBlock
Copy link
Collaborator

I'm confused, isn't there clearly an out-of-bounds error displayed in an error popup before you check the console? Anyway, the error occurs while the sort is still running, so it seems like it's an issue with your own sort.

@rylid-umil
Copy link
Author

rylid-umil commented Jul 13, 2024

What could the issue be then? Also, before i did the recording, there was no error message that popped up.
If it was a Highlights.markArray(1, 32768);, it would have shown an out of bounds error originating from a markArray, but here it shows from a clearAllMarks.

@rylid-umil
Copy link
Author

rylid-umil commented Jul 13, 2024

I've traced down the reason, described in this PR #101
image
So it is a problem with my sort, but it doesn't throw an exception early due to this.
This probably also is the case with FlammerSort, but it doesn't seem to happen with lengths < 32768 (it works just fine no errors in console or in program)

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

No branches or pull requests

2 participants