Skip to content

Conversation

AlexTyrer
Copy link
Contributor

@AlexTyrer AlexTyrer commented Sep 19, 2024

Description

A user reported that the Editor sometimes crashed on Mac when running (their) tests in the Editor's TestRunner window

This PR addresses the root cause of the problem: stale object references were resulting in the input system accessing somewhat random memory addresses to read device state.

Some random memory address access can cause the Mac OS kernel to terminate the application instead of returning an exception to the process (this does not appear to happen on Windows).

Changes made

Added deviceIndex checks when accessing InputStateBuffers.DoubleBuffers front and back buffers to avoid reading random memory.

Testing

Local testing of the user's supplied reproduction project.

Risk

Minimal risks - these changes prevent access to essentially random memory addresses when reading device state.

Checklist

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

…s to deleted InputDevice objects (case ISXB-606)

o Stale InputDevice references were resulting in random memory accesses.
o On Mac some invalid memory accesses (to kernel reserved VM ranges) cannot be caught by the application - the kernel will terminate the process instead.
o Add deviceIndex checks when accessing DoubleBuffers front/back buffers to avoid reading random memory.
@AlexTyrer AlexTyrer changed the title Fixed potential crash on Mac when using stale references to deleted InputDevice objects (case ISXB-606) FIX: Fixed potential crash on Mac when using stale references to deleted InputDevice objects (case ISXB-606) Sep 19, 2024
@AlexTyrer AlexTyrer requested a review from ekcoh September 19, 2024 15:32
@ekcoh
Copy link
Collaborator

ekcoh commented Sep 23, 2024

Would have been nice with a test case triggering the issue but not sure whether its difficult to replicate the scenario?

@AlexTyrer AlexTyrer merged commit f1458e3 into develop Sep 23, 2024
77 of 78 checks passed
@AlexTyrer AlexTyrer deleted the isxb-606-input-control-state-buffer-crash-on-mac branch September 23, 2024 08:50
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.

2 participants