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

[ui] Reduce confusion when qml loading fails #1728

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Jul 14, 2022

Currently we disable all logging out of qml by default. This is problematic in case qml loading fails for any reason (e.g. missing dependencies) as the user will be presented with a message that is not actionable: "QQmlApplicationEngine failed to load component". There is no way to understand what's happening unless the user knows about MESHROOM_OUTPUT_QML_WARNINGS.

This is improved by checking for presence of "QQmlApplicationEngine failed to load component" and warning if qml logging is disabled in that case.

There has been many issues with this log message and no further logs in the bug tracker, so I'm not the only one who hit this issue. Hopefully this improves debugging experience for everyone.

@p12tic
Copy link
Contributor Author

p12tic commented Jul 22, 2022

@fabiencastan Just a friendly ping :-)

Comment on lines 54 to 65
# If MESHROOM_OUTPUT_QML_WARNINGS is not set and an error in qml files happen we're left
# without any output except "QQmlApplicationEngine failed to load component". This is
# extremely hard to debug to someone who does not know about MESHROOM_OUTPUT_QML_WARNINGS
# beforehand because by default Qml will output errors to stdout.
if "QQmlApplicationEngine failed to load component" in message and \
not cls.outputQmlWarnings:
logging.warning("Failed to load QML component, set MESHROOM_OUTPUT_QML_WARNINGS=1 "
"to debug why")

# discard blacklisted Qt messages related to QML when 'output qml warnings' is set to false
if not cls.outputQmlWarnings and any(w in message for w in cls.qmlWarningsBlacklist):
return
Copy link
Member

Choose a reason for hiding this comment

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

Not tested:

Suggested change
# If MESHROOM_OUTPUT_QML_WARNINGS is not set and an error in qml files happen we're left
# without any output except "QQmlApplicationEngine failed to load component". This is
# extremely hard to debug to someone who does not know about MESHROOM_OUTPUT_QML_WARNINGS
# beforehand because by default Qml will output errors to stdout.
if "QQmlApplicationEngine failed to load component" in message and \
not cls.outputQmlWarnings:
logging.warning("Failed to load QML component, set MESHROOM_OUTPUT_QML_WARNINGS=1 "
"to debug why")
# discard blacklisted Qt messages related to QML when 'output qml warnings' is set to false
if not cls.outputQmlWarnings and any(w in message for w in cls.qmlWarningsBlacklist):
return
if not cls.outputQmlWarnings:
# If MESHROOM_OUTPUT_QML_WARNINGS is not set and an error in qml files happen we're left
# without any output except "QQmlApplicationEngine failed to load component". This is
# extremely hard to debug to someone who does not know about MESHROOM_OUTPUT_QML_WARNINGS
# beforehand because by default Qml will output errors to stdout.
if "QQmlApplicationEngine failed to load component" in message:
logging.warning("Set MESHROOM_OUTPUT_QML_WARNINGS=1 to get more detailed error message.")
# discard blacklisted Qt messages related to QML when 'output qml warnings' is not enabled
elif any(w in message for w in cls.qmlWarningsBlacklist):
return

Copy link
Member

Choose a reason for hiding this comment

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

@p12tic Could you have a look to do this minor update before merge?

@p12tic p12tic force-pushed the reduce-qml-crash-confusion branch from eb3ea46 to d3e3bfd Compare August 4, 2022 12:25
@p12tic
Copy link
Contributor Author

p12tic commented Aug 25, 2022

@fabiencastan friendly ping :-) I think this PR is good to go in.

logging.warning("Failed to load QML component, set MESHROOM_OUTPUT_QML_WARNINGS=1 "
"to debug why")

if any(w in message for w in cls.qmlWarningsBlacklist):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if any(w in message for w in cls.qmlWarningsBlacklist):
# discard blacklisted Qt messages related to QML when 'output qml warnings' is not enabled
elif any(w in message for w in cls.qmlWarningsBlacklist):

Copy link
Member

Choose a reason for hiding this comment

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

I have not tested it, but "elif" would make sense, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, this way full original message will be included.

Comment on lines 63 to 64
logging.warning("Failed to load QML component, set MESHROOM_OUTPUT_QML_WARNINGS=1 "
"to debug why")
Copy link
Member

@fabiencastan fabiencastan Aug 25, 2022

Choose a reason for hiding this comment

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

Suggested change
logging.warning("Failed to load QML component, set MESHROOM_OUTPUT_QML_WARNINGS=1 "
"to debug why")
logging.warning("Set MESHROOM_OUTPUT_QML_WARNINGS=1 to get a detailed error message.")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed. Sorry for not noticing these changes in your original suggestion. I should just have applied it instead of rewriting manually.

@p12tic p12tic force-pushed the reduce-qml-crash-confusion branch from d3e3bfd to 0170d01 Compare August 25, 2022 15:46
Currently we disable all logging out of qml by default. This is
problematic in case qml loading fails for any reason (e.g. missing
dependencies) as the user will be presented with a message that is not
actionable: "QQmlApplicationEngine failed to load component". There is
no way to understand what's happening unless the user knows about
MESHROOM_OUTPUT_QML_WARNINGS.

This is improved by checking for presence of "QQmlApplicationEngine
failed to load component" and warning if qml logging is disabled in that
case.
@p12tic p12tic force-pushed the reduce-qml-crash-confusion branch from 0170d01 to 9365a37 Compare August 25, 2022 15:47
@fabiencastan fabiencastan added this to the Meshroom 2022.1.0 milestone Aug 25, 2022
@fabiencastan fabiencastan merged commit 78e19a1 into alicevision:develop Aug 25, 2022
@p12tic p12tic deleted the reduce-qml-crash-confusion branch August 25, 2022 22:09
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.

2 participants