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

[Backport release-3_10] Fix Task manager waitforfinished #36651

Closed

Conversation

rldhont
Copy link
Contributor

@rldhont rldhont commented May 22, 2020

Description

Manually backport #32838 needed for #36624

This PR fixes Task::waitForFinished methods. The method doesn't wait the task to be finished if the task has not yet being started (because the task wait to start if there is no thread available for instance).

It could lead to crashes (If you access some shared memory data believing the task has finished to run)

@rldhont rldhont added Backport Is a backport of another pull request Bug Either a bug report, or a bug fix. Let's hope for the latter! labels May 22, 2020
@rldhont rldhont added this to the 3.10.7 (LTR) milestone May 22, 2020
@troopa81
Copy link
Contributor

Just for the record, there is other race conditions issues fixed in here #35200. But the one you backport could be enough to fix your issue.

I decided on purpose to not backport those because it was a lot of critical modifications in LTR. So far, no one has ever complained in master and 3.12 but I'm still unsure about backporting it. @nyalldawson any opinion on this

@rldhont
Copy link
Contributor Author

rldhont commented May 26, 2020

Thanks @troopa81 for your comments.

@elpaso can I request your point of you about this backport needed to fix an issue in QGIS Server #36624 ?

@nyalldawson
Copy link
Collaborator

nyalldawson commented May 26, 2020

I'm -0 to backporting these, simply because the consequences of a regression are extreme. (On the other hand, I haven't seen any issues raised since the fixes landed in 3.12/master)

If we do decide to backport them, then you'll need to backport ALL the task manager fixes, as one of the follow up commits may also be required.

@rldhont
Copy link
Contributor Author

rldhont commented May 27, 2020

Thanks @nyalldawson for your feedback.

If I cannot merge this backport, I will re-introduced and fix an event loop to wait for task starting in QgsAbstractContentCache.

rldhont added a commit to rldhont/QGIS that referenced this pull request May 27, 2020
The method QgsTask::waitForFinished doesn't wait the task to be finished if the task has not yet being started (because the task wait to start if there is no thread available for instance).

This bug has been fixed in a much nicer way in version 3.12 and upper, but it has not been backported to version 3.10. If qgis#32838 is backported, for example with qgis#36651, this commit has to be revert.
@elpaso
Copy link
Contributor

elpaso commented May 27, 2020

@rldhont I trust @nyalldawson 's opinion on this one, I've been bitten by the event loop recently and the side effects of an event loop are really dangerous but on the other hand we've lived with that for quite a long time.

The choice between backporting all the qgstask patches or reintroduce the event loop is ultimately up to you, I'm sorry but I can't tell which one is the less risky here.

@rldhont
Copy link
Contributor Author

rldhont commented May 27, 2020

If I can't backport only this bugfix, I don't want to take the risk to backport all the QgsTask if @nyalldawson think it's risky.

I have reintroduced the event loop in #36624. If I can merge #36624 with the event loop I will close this one.

@nyalldawson
Copy link
Collaborator

I'm -1 to introducing an event loop here. That's an extremely dangerous change, totally unsuitable for LTR.

@rldhont
Copy link
Contributor Author

rldhont commented May 28, 2020

@nyalldawson I have not introduced a new event loop in LTR. I have just fix an already existing event loop in LTR.

@rldhont
Copy link
Contributor Author

rldhont commented Jun 8, 2020

If no reject #36651, I will merge it and close this one

@rldhont
Copy link
Contributor Author

rldhont commented Jun 10, 2020

#36624 has been merged, so I close this one

@rldhont rldhont closed this Jun 10, 2020
@rldhont rldhont deleted the backport-32838-release-3_10 branch July 26, 2020 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport Is a backport of another pull request Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants