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

[WIP] [CI] Fix unsoundess #49

Merged
merged 24 commits into from
Jan 17, 2023
Merged

[WIP] [CI] Fix unsoundess #49

merged 24 commits into from
Jan 17, 2023

Conversation

katyo
Copy link
Owner

@katyo katyo commented Aug 31, 2022

No description provided.

Rodrigodd and others added 2 commits August 26, 2022 17:42
This mainly fix issue #41, that causes crashes when a `AudioStream` was
drop. That happen because the `AudioStream` was not closed on Drop, but
was deleted, causing a use-after-free by the not closed `onDataCallback`
thread.

Also, the method `AudioStreamBuilder::open_stream` was using the
deprecated method `openStream(AudioStream*)`, that do not allow deleting
the `AudioStream` safely. Replaced it by
`openStream(shared_ptr<AudioStream>)`.  The deprecated function allowed
a use-after-free by the `onErrorCallback` thread.

Also, as noted by issue #45, the bindings for `AudioStream::close()` was
wrongly bound to the concrete implementation of the base class, instead
of calling the virtual method.

Also note that currently there is no safe way to delete the
`onErrorCallback` of a `AudioStream` in oboe (see
google/oboe#1610), so instead the current
implementation leaks the callback on drop.

Also, remove some unsound `Drop` implementations and replace them by
explicit unsafe delete methods.
@katyo katyo force-pushed the fix-unsoundess branch 3 times, most recently from 0cf4345 to 0dac6eb Compare September 1, 2022 05:06
@torokati44
Copy link
Contributor

torokati44 commented Sep 3, 2022

I think removing the [patch.crates-io] section from Cargo.toml might help progressing the CI workflow. It did for me at least. Both glutin and winit have gained android support since those patches were added AFAIK.

See: https://github.com/katyo/oboe-rs/runs/8171082948?check_suite_focus=true#step:10:563

This allows updating glutin to 0.29, making the oboe-demo work on
Android without using a patched version of glutin. Could have updated to
0.30, but that would imply in fixing breaking changes.
This class were already deprecated in oboe 1.5.0, and was splitted in
AudioStreamErrorCallback and AudioStreamDataCallback.

Removing the use of this class is one step in using the methods
setErrorCallback and setDataCallback introduced in the last version,
that will allow fixing the workaround were the callback is leaked.
The previous API for setErrorCallback didn't allow soundly deleting the
errorCallback, which led oboe-rs to leak the callback.

The new API receives holds a shared_ptr, fixing the issue.
Before, the code in Rust side were resposible of freeing the callback.
But now that oboe's API receives a shared_ptr, that does automatic
memory management, we no longer need to hold the callback in the Rust
side.
@katyo katyo force-pushed the fix-unsoundess branch 3 times, most recently from cd393f2 to bb4f893 Compare January 16, 2023 20:20
@Rodrigodd
Copy link
Contributor

@katyo I think CI is failing because your APK_SIGN_KEY_DATA contain line breaks. I was hitting the same thing when I as trying it out.

- Update outdated actions
- Remove deprecated ::set-output commands in favor of using $GITHUB_OUTPUT
- Add apk signing keystore to repository
- Generate temporary apk signing keystore if no password provided via secrets
So we avoids unnecessary allocation when creating stream via builder.
@katyo
Copy link
Owner Author

katyo commented Jan 17, 2023

@Rodrigodd Course, I added keystore to repo.
Also I added rules to generate temporary keystore when no password provided to avoid issues with CI in forks.

@katyo
Copy link
Owner Author

katyo commented Jan 17, 2023

@Rodrigodd Could you help me test this pr?

@Rodrigodd
Copy link
Contributor

@katyo The demo appears to work okay, but one of my projects is crashing. I will investigate it, and try to find out where is the problem.

@Rodrigodd
Copy link
Contributor

@katyo The problem was that I was actually running the project without the patch. With the patch applied everything is working fine.

@katyo katyo merged commit 69b570f into master Jan 17, 2023
@katyo katyo mentioned this pull request Jan 19, 2023
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.

None yet

3 participants