-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 deadlock in oath2 authentication #59557
base: master
Are you sure you want to change the base?
Commits on Nov 22, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 23ce137 - Browse repository at this point
Copy the full SHA 23ce137View commit details -
Configuration menu - View commit details
-
Copy full SHA for 37576e5 - Browse repository at this point
Copy the full SHA 37576e5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d14eb9 - Browse repository at this point
Copy the full SHA 2d14eb9View commit details -
Remove support for non-internal o2 library
The internal copy of the o2 library has customisations and API changes which are required for QGIS... as a result it hasn't been possible to build with the non-internal library version for years. Remove all this dead/unused code.
Configuration menu - View commit details
-
Copy full SHA for 81d221c - Browse repository at this point
Copy the full SHA 81d221cView commit details -
OAuth2 config cache should not be static
We only ever create one instance of a QgsAuthMethod, so there's no need for this member to be static
Configuration menu - View commit details
-
Copy full SHA for a18ea54 - Browse repository at this point
Copy the full SHA a18ea54View commit details -
Protect config cache in QgsAuthOAuth2Method with read/write lock
This is being accessed across multiple threads, so we need to protect access accordingly
Configuration menu - View commit details
-
Copy full SHA for a353e70 - Browse repository at this point
Copy the full SHA a353e70View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b37709 - Browse repository at this point
Copy the full SHA 5b37709View commit details -
Simplify QgsAuthOAuth2Method::getOAuth2Bundle
We do not need to use deleteLater here for QgsAuthOAuth2Config, so we can considerably simplify the logic
Configuration menu - View commit details
-
Copy full SHA for a504af7 - Browse repository at this point
Copy the full SHA a504af7View commit details -
Avoid leak of QgsAuthOAuth2Config
And make ownership clear by setting parent to the QgsO2 parent
Configuration menu - View commit details
-
Copy full SHA for 317a1fb - Browse repository at this point
Copy the full SHA 317a1fbView commit details -
Fix deadlock in oath2 authentication
We have to take care that we don't directly create QgsO2 objects on the thread where the authentication request is occurring, as QgsO2 objects are long running but the thread requesting authentication may be short-lived. If we create QgsO2 objects on a short-running thread, then when we later try to authenticate using the same oauth2 authentication method we will get a deadlock, as the O2 reply server will no longer have an active thread or an event loop running. This was especially evident in browser items which use oauth2 authentication. Since these are usually populated using very short-life threads, we'd often hit this situation: 1. The connection would be expanded. Browser would create a thread to populate the connection. The oauth2 objects would then be created on this same thread, and everything would initially work OK. The user could complete the authentication since the browser population thread was blocked until this was done. 2. The browser item got populated, and then the thread populating it was destroyed 3. Later, something else would request authentication using the same oauth2 config. This may be eg the user expanding out a different folder on the browser connection. 4. If the oauth2 token had expired, then we'd try to refresh it. But this relied on event-based logic, and the event loop for the QgsO2 object was no longer around to handle this. The authentication request would dead-lock. Fix this by ensuring that all QgsO2 objects are created and run on an instance of a new QgsOAuth2Factory QThread. This thread is created on demand, and will then exist for the life of the QGIS session. This ensures that all QgsO2 objects will run on a thread with an application-long lifetime, so there's no issue if they later require event-loop based logic (such as token refresh)
Configuration menu - View commit details
-
Copy full SHA for e72e2b7 - Browse repository at this point
Copy the full SHA e72e2b7View commit details -
Ensure that O2 linkage is done in a thread-safe way
We need to ensure that the link method is ONLY ever called from the QgsO2 object's thread, because it involves creation of child items and that is explicitly prohibited from external threads by Qt.
Configuration menu - View commit details
-
Copy full SHA for a8116e9 - Browse repository at this point
Copy the full SHA a8116e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 58e0ff1 - Browse repository at this point
Copy the full SHA 58e0ff1View commit details -
Configuration menu - View commit details
-
Copy full SHA for c568a98 - Browse repository at this point
Copy the full SHA c568a98View commit details -
Configuration menu - View commit details
-
Copy full SHA for b634c2a - Browse repository at this point
Copy the full SHA b634c2aView commit details -
Configuration menu - View commit details
-
Copy full SHA for c69bd89 - Browse repository at this point
Copy the full SHA c69bd89View commit details -
Configuration menu - View commit details
-
Copy full SHA for a945d33 - Browse repository at this point
Copy the full SHA a945d33View commit details -
Configuration menu - View commit details
-
Copy full SHA for 13e40c8 - Browse repository at this point
Copy the full SHA 13e40c8View commit details -
Revert "Remove support for non-internal o2 library"
This reverts commit 81d221c.
Configuration menu - View commit details
-
Copy full SHA for 8c46b3e - Browse repository at this point
Copy the full SHA 8c46b3eView commit details