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

Remove nonfunctional and crashy pacrunner caching #128

Merged
merged 1 commit into from
Nov 10, 2020
Merged

Remove nonfunctional and crashy pacrunner caching #128

merged 1 commit into from
Nov 10, 2020

Conversation

mcatanzaro
Copy link
Contributor

libproxy currently attempts to cache pacrunner objects in the pr member
variable of its pacrunner_extension object. This is broken, though,
because it relies on the pacrunner object also being stored in
pacrunner_extension's last member variable, which is never written to.
So that caching has never worked properly. In practice, it only does one
thing: it causes a threadsafety bug, #68, because it causes the old
pacrunner object to be deleted on the thread that is creating the new
pacrunner, which is illegal for both the mozjs and WebKit-based
pacrunner extensions that expect their objects to be deleted on the same
thread they were created on.

This patch was originally written by Dan Winship for Fedora 19. It got
dropped in Fedora 24, then resurrected again for Fedora 28 after we
noticed 30,000 crash reports. I've tweaked it a bit to completely
remove the unused member variables.

https://bugzilla.redhat.com/show_bug.cgi?id=998232

Fixes #68

@DimStar77
Copy link
Contributor

Can you please rebase this? Let's try to get a new version ready (and then let's push for a 0.5 branch with dbus enabled - getting the js parser out of process)

libproxy currently attempts to cache pacrunner objects in the pr member
variable of its pacrunner_extension object. This is broken, though,
because it relies on the pacrunner object also being stored in
pacrunner_extension's last member variable, which is never written to.
So that caching has never worked properly. In practice, it only does one
thing: it causes a threadsafety bug, #68, because it causes the old
pacrunner object to be deleted on the thread that is creating the new
pacrunner, which is illegal for both the mozjs and WebKit-based
pacrunner extensions that expect their objects to be deleted on the same
thread they were created on.

This patch was originally written by Dan Winship for Fedora 19. It got
dropped in Fedora 24, then resurrected again for Fedora 28 after we
noticed 30,000 crash reports. I've tweaked it a bit to completely
remove the unused member variables.

Finally, note that this code is not exception-safe: if an exception is
thrown, the pacrunner could be leaked. But this seems to be a common
problem throughout libproxy. It should be fixed by using std::unique_ptr
instead of raw new and delete.

https://bugzilla.redhat.com/show_bug.cgi?id=998232

Fixes #68
@mcatanzaro
Copy link
Contributor Author

Rebased.

@DimStar77 DimStar77 merged commit 160d9bd into libproxy:master Nov 10, 2020
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.

px_proxy_factory_get_proxies not thread-safe
2 participants