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

fix(bridge): Synchronize access to Strong handles in collection adapters #1144

Merged
merged 3 commits into from
May 20, 2019

Conversation

mbektchiev
Copy link
Contributor

PR Checklist

  • TNSArrayAdapter, TNSDataAdapter and TNSDictionaryAdapter hold Strong
    references to their underlying JS objects. When the Objective-C instances of these
    classes were dealloc-ed, these references' destructors were being called outside
    of the JSC VM's lock which lead to nasty and rarely occurring crashes when such
    adapters are being used in threads different than the main thread of the JSC engine.

    • Do not store ExecStates as calls to an adapter can be made long after the JS
      state has changed. Use global object's globalExec instead.
    • Reset Strong handles inside the locked section. This way the C++ destructor
      of a nullptr handle will not have to modify anything in the VM's heap.
  • Dump the native and JavaScript callstacks when any
    of SIGABRT SIGILL, SIGSEGV, SIGFPE or SIGBUS is received.

Dump the native and JavaScript callstacks when any
of SIGABRT SIGILL, SIGSEGV, SIGFPE or SIGBUS is received.
`TNSArrayAdapter`, `TNSDataAdapter` and `TNSDictionaryAdapter` hold `Strong`
references to their underlying JS objects. When the Objective-C instances of these
classes were `dealloc`-ed, these references' destructors were being called outside
of the JSC VM's lock which lead to nasty and rarely occurring crashes when such
adapters are being used in threads different than the main thread of the JSC engine.

* Do not store `ExecState`s as calls to an adapter can be made long after the JS
state has changed. Use global object's `globalExec` instead.
* Reset `Strong` handles inside the locked section. This way the C++ destructor
of a nullptr handle will not have to modify anything in the VM's heap.
@mbektchiev mbektchiev added the bug label May 20, 2019
@mbektchiev mbektchiev added this to the 5.4.1 milestone May 20, 2019
@mbektchiev mbektchiev self-assigned this May 20, 2019
@cla-bot cla-bot bot added the cla: yes label May 20, 2019
@mbektchiev mbektchiev changed the base branch from master to release May 20, 2019 13:56
@mbektchiev mbektchiev merged commit f101453 into release May 20, 2019
@mbektchiev mbektchiev deleted the bektchiev/fix-sap-crashes branch May 20, 2019 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants