WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
87672
[Qt] Add quirks for running the web process in a profiler shell, like valgrind
https://bugs.webkit.org/show_bug.cgi?id=87672
Summary
[Qt] Add quirks for running the web process in a profiler shell, like valgrind
Balazs Kelemen
Reported
2012-05-28 09:56:41 PDT
The only reliable way to run the web process in valgrind is to change ProcessLauncherQt.cpp. I think it's worth to add an env var quirk for this.
Attachments
Patch
(4.34 KB, patch)
2012-05-28 10:18 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(2.57 KB, patch)
2012-05-29 04:55 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(3.06 KB, patch)
2012-06-02 10:20 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(3.04 KB, patch)
2012-06-06 10:19 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(6.04 KB, patch)
2012-06-12 07:59 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(6.10 KB, patch)
2012-06-13 07:56 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(5.94 KB, patch)
2012-07-11 09:17 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(6.34 KB, patch)
2012-07-13 08:55 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Patch
(6.34 KB, patch)
2012-07-13 09:02 PDT
,
Balazs Kelemen
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Balazs Kelemen
Comment 1
2012-05-28 10:18:32 PDT
Created
attachment 144381
[details]
Patch
Caio Marcelo de Oliveira Filho
Comment 2
2012-05-29 01:25:50 PDT
Comment on
attachment 144381
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=144381&action=review
Cool! :-) I have some comments. I wish these debugging features / environment variables were more discoverable, maybe we could add a --help to our main.cpp to describe them?
> Source/WebKit2/ChangeLog:9 > + Consider the enironment variables QT_WEB_PROCESS_COMMAND_PREFIX > + and QT_PLUGIN_PROCESS_COMMAND_PREFIX. If set use their values as
Typo "environment". I think it would be clearer to just say: "If environment variables QT_WEB_... and QT_PLUGIN_... are set, use their values...". Also other environment variables use QT_WEBKIT_ prefix, maybe we should follow the same here.
> Tools/ChangeLog:8 > + Add a dedicated environment variable quirk (QT_WTR_NO_TIMEOUT)
Why existing --no-timeout option is not enough?
Balazs Kelemen
Comment 3
2012-05-29 04:55:17 PDT
Created
attachment 144525
[details]
Patch
Balazs Kelemen
Comment 4
2012-05-29 04:58:00 PDT
(In reply to
comment #2
)
> (From update of
attachment 144381
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=144381&action=review
> > Cool! :-) I have some comments. I wish these debugging features / environment variables were more discoverable, maybe we could add a --help to our main.cpp to describe them?
I don't think it belongs to either MiniBrowser or WebKitTestRunner. I will update the wiki with these ;)
> > > Source/WebKit2/ChangeLog:9 > > + Consider the enironment variables QT_WEB_PROCESS_COMMAND_PREFIX > > + and QT_PLUGIN_PROCESS_COMMAND_PREFIX. If set use their values as > > Typo "environment". I think it would be clearer to just say: "If environment variables QT_WEB_... and QT_PLUGIN_... are set, use their values...". > > Also other environment variables use QT_WEBKIT_ prefix, maybe we should follow the same here.
Fixed both.
> > > Tools/ChangeLog:8 > > + Add a dedicated environment variable quirk (QT_WTR_NO_TIMEOUT) > > Why existing --no-timeout option is not enough?
Good point, I removed that.
Balazs Kelemen
Comment 5
2012-05-29 06:26:22 PDT
> > > > > > Tools/ChangeLog:8 > > > + Add a dedicated environment variable quirk (QT_WTR_NO_TIMEOUT) > > > > Why existing --no-timeout option is not enough? > > Good point, I removed that.
Hm, actually it is not enough, because it only disables the watchdog timer, not the runloop timer. But it's another bug.
Simon Hausmann
Comment 6
2012-06-01 23:43:09 PDT
Comment on
attachment 144525
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=144525&action=review
I think this is a very good idea (r+). But please fix the string handling before landing. Just call qgetenv() every time and remember to use constData() if you can. In this case I would even argue that the use of arg() is overkill, this is merely about concatenating a bunch of strings, so perhaps it would make sense to use the string builder in Qt with the % operator:
http://doc-snapshot.qt-project.org/5.0/qstring.html#more-efficient-string-construction
> Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:105 > + static QByteArray webProcessPrefix = qgetenv("QT_WEBKIT_WEB_PROCESS_COMMAND_PREFIX"); > + static QByteArray pluginProcessPrefix = qgetenv("QT_WEBKIT_PLUGIN_PROCESS_COMMAND_PREFIX");
I wouldn't simply bother with making those global variables. The strings are already global in the environment and we don't launch processes often enough to IMHO justify the time we "save" by not extracting the strings again out of the environment. At the same time the _copy_ of the string uses memory for no reason :)
> Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:118 > + QString commandLine = prefix.isEmpty() ? QStringLiteral("%1 %2") : QString(QStringLiteral("%1 %2 %3")).arg(QLatin1String(prefix.data()));
By calling data() instead of constData() you'll end up creating a copy of the QByteArray for no reason. The non-const data() calls detach() and will detach because the refcount will be 2 (the original prefix variable holds one ref, the local prefix variable another one).
Balazs Kelemen
Comment 7
2012-06-02 07:02:50 PDT
(In reply to
comment #5
)
> > > > > > > > > Tools/ChangeLog:8 > > > > + Add a dedicated environment variable quirk (QT_WTR_NO_TIMEOUT) > > > > > > Why existing --no-timeout option is not enough? > > > > Good point, I removed that. > > Hm, actually it is not enough, because it only disables the watchdog timer, not the runloop timer. But it's another bug.
No, I misread it. It should be enough.
Balazs Kelemen
Comment 8
2012-06-02 10:17:17 PDT
(In reply to
comment #6
)
> (From update of
attachment 144525
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=144525&action=review
> > I think this is a very good idea (r+). But please fix the string handling before landing. Just call qgetenv() every time and remember to use constData() if you can. > > In this case I would even argue that the use of arg() is overkill, this is merely about concatenating a bunch of strings, so perhaps it would make sense to use the string builder in Qt with the % operator:
Thanks for the detailed review. It's enough for another round, so I'm going to upload a new patch.
Balazs Kelemen
Comment 9
2012-06-02 10:20:11 PDT
Created
attachment 145449
[details]
Patch
Tor Arne Vestbø
Comment 10
2012-06-06 09:09:52 PDT
Comment on
attachment 145449
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=145449&action=review
> Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:110 > + commandLine = commandLine % static_cast<QString>(executablePathOfWebProcess());
static_cast?
> Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:115 > + commandLine = commandLine % static_cast<QString>(executablePathOfPluginProcess());
??
Balazs Kelemen
Comment 11
2012-06-06 10:19:04 PDT
Created
attachment 146057
[details]
Patch
Balazs Kelemen
Comment 12
2012-06-12 07:40:18 PDT
(In reply to
comment #7
)
> (In reply to
comment #5
) > > > > > > > > > > > > Tools/ChangeLog:8 > > > > > + Add a dedicated environment variable quirk (QT_WTR_NO_TIMEOUT) > > > > > > > > Why existing --no-timeout option is not enough? > > > > > > Good point, I removed that. > > > > Hm, actually it is not enough, because it only disables the watchdog timer, not the runloop timer. But it's another bug. > > No, I misread it. It should be enough.
D'oh, misread again. It's enough with QT_WEBKIT2_DEBUG but we don't want this with valgrind. I'm going to add a switch for the responsiveness timer.
Balazs Kelemen
Comment 13
2012-06-12 07:59:05 PDT
Created
attachment 147087
[details]
Patch
Tor Arne Vestbø
Comment 14
2012-06-13 07:22:33 PDT
Comment on
attachment 147087
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=147087&action=review
> Tools/WebKitTestRunner/TestController.cpp:569 > + if (!m_useRensponsivityTimer) { > + platformRunUntil(done, m_noTimeout); > + return; > + } > +
Why don't we just call runUntil() with NoTimeout ?
Balazs Kelemen
Comment 15
2012-06-13 07:56:27 PDT
Created
attachment 147315
[details]
Patch
Jocelyn Turcotte
Comment 16
2012-07-11 07:09:14 PDT
Comment on
attachment 147315
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=147315&action=review
> Source/WebKit2/ChangeLog:9 > + and/or QT_WEBKIT_PLUGIN_PROCESS_COMMAND_PREFIX set, use their
*are* set,
> Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:107 > + QByteArray webProcessPrefix = qgetenv("QT_WEBKIT_WEB_PROCESS_COMMAND_PREFIX");
1. This is pretty long 2. It would be nice if this name would align with QT_WEBKIT2_DEBUG since their use cases are related. So maybe we could name them QT_WEBKIT2_WP_CMD_PREFIX and QT_WEBKIT2_PP_CMD_PREFIX?
> Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:110 > + if (!webProcessPrefix.isEmpty()) > + commandLine = QLatin1String(webProcessPrefix.constData()) % QLatin1Char(' '); > + commandLine = commandLine % QString(executablePathOfWebProcess());
This can be simplified to: commandLine = QLatin1String(webProcessPrefix.constData()) % QLatin1Char(' ') % QString(executablePathOfWebProcess());
> Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:153 > - commandLine = commandLine.arg(sockets[0]); > + commandLine = commandLine % QLatin1Char(' ') % QString::number(sockets[0]);
You can leave that one as it is, arg() is perfect for this and reads better if you have to convert to numbers anyway.
> Tools/ChangeLog:11 > + profiling purposes because it only effects the timeout
it only *affects*
> Tools/WebKitTestRunner/TestController.cpp:264 > + if (argument == "--no-runloop-timeout") {
I'm wondering if it wouldn't be better to just also avoid the timer in TestControllerQt if m_useWaitToDumpWatchdogTimer is false. Please try it and if it works I would avoid adding an extra command line argument which might cause confusion. A lot of people that tried to run this into valgrind probably tried --no-timout because it sounds right from that point of view.
Jocelyn Turcotte
Comment 17
2012-07-11 08:41:41 PDT
Comment on
attachment 147315
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=147315&action=review
>> Tools/WebKitTestRunner/TestController.cpp:264 >> + if (argument == "--no-runloop-timeout") { > > I'm wondering if it wouldn't be better to just also avoid the timer in TestControllerQt if m_useWaitToDumpWatchdogTimer is false. Please try it and if it works I would avoid adding an extra command line argument which might cause confusion. A lot of people that tried to run this into valgrind probably tried --no-timout because it sounds right from that point of view.
Ok talked on IRC and that would probably break performance tests, so let's add a switch and maybe rename it to something clearer to those not wanting to read the code.
> Tools/WebKitTestRunner/TestController.cpp:571 > + if (!m_useRunloopTimer) { > + platformRunUntil(done, m_noTimeout); > + return; > + } > + > double timeout; > switch (timeoutDuration) {
Try to avoid the duplicate call to platformRunUntil. Something like: double timeout = m_noTimeout; if (m_useRunLoopTimer) { switch (timeoutDuration) { ....
> Tools/WebKitTestRunner/TestController.h:132 > + bool m_useRunloopTimer;
Maybe rename this to m_forceNoTimeout.
Balazs Kelemen
Comment 18
2012-07-11 09:17:48 PDT
Created
attachment 151715
[details]
Patch
Balazs Kelemen
Comment 19
2012-07-11 09:20:44 PDT
(In reply to
comment #16
)
> (From update of
attachment 147315
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=147315&action=review
> > > Source/WebKit2/ChangeLog:9 > > + and/or QT_WEBKIT_PLUGIN_PROCESS_COMMAND_PREFIX set, use their > > *are* set, > > > Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:107 > > + QByteArray webProcessPrefix = qgetenv("QT_WEBKIT_WEB_PROCESS_COMMAND_PREFIX"); > > 1. This is pretty long > 2. It would be nice if this name would align with QT_WEBKIT2_DEBUG since their use cases are related. > So maybe we could name them QT_WEBKIT2_WP_CMD_PREFIX and QT_WEBKIT2_PP_CMD_PREFIX?
Done, done.
> > > Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:110 > > + if (!webProcessPrefix.isEmpty()) > > + commandLine = QLatin1String(webProcessPrefix.constData()) % QLatin1Char(' '); > > + commandLine = commandLine % QString(executablePathOfWebProcess()); > > This can be simplified to: > commandLine = QLatin1String(webProcessPrefix.constData()) % QLatin1Char(' ') % QString(executablePathOfWebProcess()); > > > Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp:153 > > - commandLine = commandLine.arg(sockets[0]); > > + commandLine = commandLine % QLatin1Char(' ') % QString::number(sockets[0]); > > You can leave that one as it is, arg() is perfect for this and reads better if you have to convert to numbers anyway.
Simplified and changed back to use QString::arg as discussed on irc since it is more readable and it only runs once so we should not bother optmising it.
Balazs Kelemen
Comment 20
2012-07-11 09:21:10 PDT
(In reply to
comment #17
)
> (From update of
attachment 147315
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=147315&action=review
> > >> Tools/WebKitTestRunner/TestController.cpp:264 > >> + if (argument == "--no-runloop-timeout") { > > > > I'm wondering if it wouldn't be better to just also avoid the timer in TestControllerQt if m_useWaitToDumpWatchdogTimer is false. Please try it and if it works I would avoid adding an extra command line argument which might cause confusion. A lot of people that tried to run this into valgrind probably tried --no-timout because it sounds right from that point of view. > > Ok talked on IRC and that would probably break performance tests, so let's add a switch and maybe rename it to something clearer to those not wanting to read the code. > > > Tools/WebKitTestRunner/TestController.cpp:571 > > + if (!m_useRunloopTimer) { > > + platformRunUntil(done, m_noTimeout); > > + return; > > + } > > + > > double timeout; > > switch (timeoutDuration) { > > Try to avoid the duplicate call to platformRunUntil. > Something like: > > double timeout = m_noTimeout; > if (m_useRunLoopTimer) { > switch (timeoutDuration) { > .... > > > Tools/WebKitTestRunner/TestController.h:132 > > + bool m_useRunloopTimer; > > Maybe rename this to m_forceNoTimeout.
Done, done.
Jocelyn Turcotte
Comment 21
2012-07-13 05:24:03 PDT
Comment on
attachment 151715
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=151715&action=review
> Tools/ChangeLog:12 > + profiling purposes because it only affects the timeout > + for running the actual test and we should keep this
"for running the actual test" could read something like "when waiting for the end of a test" to be clearer.
> Tools/WebKitTestRunner/TestController.cpp:264 > + if (argument == "--no-timeout-for-all") {
"No timeout for all" doesn't read so well with my limited english skills. Maybe --no-timeout-at-all or --no-timeout-ever or --no-timeout-for-debugging?
> Tools/WebKitTestRunner/TestController.cpp:265 > + m_useWaitToDumpWatchdogTimer = false;
That line won't have any effect as far as I know, since both ShortTimeout and LongTimeout will be the same as NoTimeout with your changes to runUntil.
Balazs Kelemen
Comment 22
2012-07-13 08:55:09 PDT
Created
attachment 152271
[details]
Patch
Balazs Kelemen
Comment 23
2012-07-13 09:02:06 PDT
Created
attachment 152272
[details]
Patch synced changelog
Balazs Kelemen
Comment 24
2012-07-13 09:02:43 PDT
(In reply to
comment #21
)
> (From update of
attachment 151715
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=151715&action=review
> > > Tools/ChangeLog:12 > > + profiling purposes because it only affects the timeout > > + for running the actual test and we should keep this > > "for running the actual test" could read something like "when waiting for the end of a test" to be clearer.
Fixed, and expanded the explanation so hopefully it is more understandable now.
> > > Tools/WebKitTestRunner/TestController.cpp:264 > > + if (argument == "--no-timeout-for-all") { > > "No timeout for all" doesn't read so well with my limited english skills. Maybe --no-timeout-at-all or --no-timeout-ever or --no-timeout-for-debugging?
Fixed, I choose --no-timeout-at-all.
> > > Tools/WebKitTestRunner/TestController.cpp:265 > > + m_useWaitToDumpWatchdogTimer = false; > > That line won't have any effect as far as I know, since both ShortTimeout and LongTimeout will be the same as NoTimeout with your changes to runUntil.
It is also used by the injected bundle, it is passed to it in TestInvocation::invoke.
Jocelyn Turcotte
Comment 25
2012-07-24 06:08:56 PDT
Comment on
attachment 152272
[details]
Patch (In reply to
comment #24
)
> It is also used by the injected bundle, it is passed to it in TestInvocation::invoke.
Yep you're right, ok looks good!
Balazs Kelemen
Comment 26
2012-07-24 06:15:02 PDT
Comment on
attachment 152272
[details]
Patch Clearing flags on attachment: 152272 Committed
r123464
: <
http://trac.webkit.org/changeset/123464
>
Balazs Kelemen
Comment 27
2012-07-24 06:15:09 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug