Open Bug 1443922 Opened 6 years ago Updated 4 months ago

Use toolkit.asyncshutdown.crash_timout as shutdown monitor base value

Categories

(Testing :: geckodriver, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: ato, Unassigned, Mentored)

References

Details

(Whiteboard: [lang=rust])

geckodriver is currently hard-coded with a 70 second wait before
forcefully killing the Firefox process.  This is adequate for regular
optimised builds, but the base value for ASAN is longer, and the value can
be overridden using the toolkit.asyncshutdown.crash_timeout preference.

Unfortunately mozprofile does not yet have a way of presenting the
union of the user.js and prefs.js files, i.e. the effective pref value.
Depends on: 1443853
Here a link to the appropriate definitions:
https://dxr.mozilla.org/mozilla-central/source/modules/libpref/init/all.js#1071-1077

(In reply to Andreas Tolfsen ‹:ato› from comment #0)
> Unfortunately mozprofile does not yet have a way of presenting the
> union of the user.js and prefs.js files, i.e. the effective pref value.

Note that whatever is in user.js will automatically be added by Firefox to prefs.js each time the browser starts. Means when a user modifies the value it will be reset with the next start/restart.
(In reply to Henrik Skupin (:whimboo) from comment #1)

> (In reply to Andreas Tolfsen ‹:ato› from comment #0)
> 
> > Unfortunately mozprofile does not yet have a way of presenting
> > the union of the user.js and prefs.js files, i.e. the effective
> > pref value.
> 
> Note that whatever is in user.js will automatically be added
> by Firefox to prefs.js each time the browser starts. Means
> when a user modifies the value it will be reset with the next
> start/restart.

OK, that’s useful.  However, mozprofile only lets you read the file
once when it is initialised because there initially was no use case
for reading the prefs file multiple times.  So some changes to
mozprofile are required.
Priority: -- → P3
Please note that we should not actually change this value, but retrieve it and make use of it in geckodriver. ASAN builds will take longer for shutdown due to various reasons. See the explanation from Andrew in bug 1472853 comment 9.

As such we have to find a way to send the information. I would propose that we use a vendor-prefixed new session parameter like `moz:shutdownTimeout`.

Andreas, I had a quick look but I'm actually struggling where to add the code to retrieve the timeout value from the returned capabilities. Also should the default timeout of 70s defined as property for MarionetteHandler? While MarionetteSettings sounds better it looks like that this struct is only used for input settings.

I would kinda like to get this fixed to reduce the amount of possible unwanted forced-kills of Firefox for ASAN jobs.

Flags: needinfo?(ato)

(In reply to Henrik Skupin (:whimboo) from comment #4)

Andreas, I had a quick look but I'm actually struggling where
to add the code to retrieve the timeout value from the returned
capabilities.

You need to have a mutable base timeout (probably leave it at 70?)
which you overwrite with the value from moz:shutdownTimeout once
the session has been established.

We handle responses over in MarionetteSession::response():
https://searchfox.org/mozilla-central/rev/5053031ba7621fa8f63f42de4c204ab3561e4e59/testing/geckodriver/src/marionette.rs#690

This is where you need to extract moz:shutdownTimeout.

Also should the default timeout of 70s defined as
property for MarionetteHandler? While MarionetteSettings
sounds better it looks like that this struct is only used for
input settings.

Yes that sounds fine. It’s a configurable user setting.

Flags: needinfo?(ato)

So the hard-coded 70s shutdown time can be found here:

https://searchfox.org/mozilla-central/rev/8d9564059dbc1e36fb9152e6b6227343d0b49662/testing/geckodriver/src/marionette.rs#429

It's part of MarionetteHandler::delete_session() that gets a Session object. As Andreas pointed out above the capabilities as part of the WebDriver:NewSession command are handled here:

https://searchfox.org/mozilla-central/rev/8d9564059dbc1e36fb9152e6b6227343d0b49662/testing/geckodriver/src/marionette.rs#835-864

That means that within delete_session() we can simply try to retrieve moz:shutdownTimeout and use it, or fallback to the hardcoded 70s.

Mentor: hskupin
Whiteboard: [lang=rust]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.