-
-
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 qgis server fcgi response destructor #59632
base: master
Are you sure you want to change the base?
Fix qgis server fcgi response destructor #59632
Conversation
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
src/server/qgsfcgiserverresponse.h
Outdated
@@ -45,11 +45,13 @@ class QgsSocketMonitoringThread: public QThread | |||
* \param isResponseFinished | |||
* \param feedback | |||
*/ | |||
QgsSocketMonitoringThread( bool *isResponseFinished, QgsFeedback *feedback ); | |||
QgsSocketMonitoringThread( QgsFeedback *feedback ); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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.
97ebe44
to
fc27b8d
Compare
… in QgsFcgiServerResponse
mSocketMonitoringThread->start(); | ||
} | ||
|
||
QgsFcgiServerResponse::~QgsFcgiServerResponse() | ||
{ | ||
mFinished = true; | ||
mSocketMonitoringThread->exit(); | ||
mSocketMonitoringThread->wait(); | ||
if ( mSocketMonitoringThread ) |
There was a problem hiding this comment.
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.
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.