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 qgis server fcgi response destructor #59632

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

benoitdm-oslandia
Copy link
Contributor

Suppress wait in fcgi response destructor

In the previous version, the response destructor waited for the monitoring thread to end that may induce a 333ms sleep each time. We fix that by using a classic ptr to separate the thread and the response lifecycles.

@benoitdm-oslandia benoitdm-oslandia self-assigned this Nov 28, 2024
@benoitdm-oslandia benoitdm-oslandia added the Server Related to QGIS server label Nov 28, 2024
@github-actions github-actions bot added this to the 3.42.0 milestone Nov 28, 2024
Copy link

github-actions bot commented Nov 28, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 118fa2e)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit cb56247)

@@ -45,11 +45,13 @@ class QgsSocketMonitoringThread: public QThread
* \param isResponseFinished
* \param feedback
*/
QgsSocketMonitoringThread( bool *isResponseFinished, QgsFeedback *feedback );
QgsSocketMonitoringThread( QgsFeedback *feedback );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the feedback? Should it become a shared ptr now that lifetime is decoupled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check the side effects

src/server/qgsfcgiserverresponse.h Outdated Show resolved Hide resolved
In the previous version, the response destructor waited for the monitoring thread to end that may induce a 333ms sleep each time. We fix that by using a classic ptr to separate the thread and the response lifecycles.
@benoitdm-oslandia benoitdm-oslandia marked this pull request as draft November 29, 2024 13:43
mSocketMonitoringThread->start();
}

QgsFcgiServerResponse::~QgsFcgiServerResponse()
{
mFinished = true;
mSocketMonitoringThread->exit();
mSocketMonitoringThread->wait();
if ( mSocketMonitoringThread )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the thread is deleted by deleteLater, mSocketMonitoringThread would not be reset to nullptr. You have to at least use a QPointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Server Related to QGIS server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants