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

#86 Crash on during evaluation #91

Merged
merged 6 commits into from
Nov 19, 2024
Merged

#86 Crash on during evaluation #91

merged 6 commits into from
Nov 19, 2024

Conversation

oers
Copy link
Owner

@oers oers commented Nov 19, 2024

No description provided.

@oers oers linked an issue Nov 19, 2024 that may be closed by this pull request
@@ -1124,7 +1123,6 @@ void _droidzebra_throw_engine_error(JNIEnv* env, const char* msg)

void _droidzebra_undo_stack_push(int val)
{
assert(s_undo_stack_pointer<64);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s_undo_stack size is 64, so if this assert is triggered here, it's definitely a bug. If we remove it, it will just silently overflow the buffer, there's no logic to grow that buffer here.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, that the stack size is too small, without the asserts everything works perfectly. But I am just trying to find out how often this is increased.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without the asserts everything works perfectly

This can be very misleading - it just means that the value is written somewhere in the memory and the program has no problems writing to it - that doesn't mean that the memory is valid. A little change in the code can move the array somewhere else in memory and cause a bug, either a crash if it's on page boundary, or something more problematic by overriding unrelated data.

I think it makes sense to increase the stack size, but I'd definitely not remove the assert, because it guards a real bug.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack size is now 120
There are 60 White and 60 Black moves maximum (each move can be a pass)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify - it's possible that the assert went away only because you've also added the undoall text and that changed the layout of the code, it may not even be related to that assert.

That would also make sense, because asserts are usually completely removed in production builds. I'm not sure if we do that here, you can test this by adding assert(false) somewhere and run a production build.

Copy link
Owner Author

@oers oers Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the assert. I reintrocuded it.
64 worked until 4 Passes were made. After that the assert always failed.
I think the asserts were disabled in production or before some c refactoring. And the Application crashed when doing redo. In my current version it crashed at undo at the assert

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack size is now 120 There are 60 White and 60 Black moves maximum (each move can be a pass)

That sounds plausible, good catch. Does the game from the bug report have a lot of passes?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like 7 or 8, Lots of passes.

@oers oers merged commit 2c544ee into development Nov 19, 2024
2 checks passed
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.

Crash on during evaluation
2 participants