Closed Bug 1909217 Opened 2 years ago Closed 2 years ago

add jsapi to reset seed for math.random

Categories

(Core :: JavaScript Engine, enhancement)

Firefox 128
enhancement

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: me, Assigned: me, NeedInfo)

Details

Attachments

(1 file)

Steps to reproduce:

In long-running environments, it's desirable for the embedding to reset the random seed at controlled points in time.

In particular, when running in WASI, a situation can occur where a VM snapshot is taken at build time using Wizer, which is then loaded and used as the basis for running separate workloads many times over. If Math.random() was called during the initialization phase, this would cause all workloads to get the same results for all consecutive calls to Math.random().

In long-running environments, it's desirable for the embedding to reset the random seed at controlled points in time.

In particular, when running in WASI, a situation can occur where a VM snapshot is taken at build time using Wizer, which is then loaded and used as the basis for running separate workloads many times over. If Math.random() was called during the initialization phase, this would cause all workloads to get the same results for all consecutive calls to Math.random().

Assignee: nobody → me
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

The Bugbug bot thinks this bug should belong to the 'Core::MathML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → MathML
Product: Firefox → Core
Component: MathML → JavaScript Engine
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3c25134b4a3e Add JSAPI for resetting the seed for Math.random(). r=jandem

Backed out for causing mass spidermonkey build bustages.
LATER EDIT: this does not cause only spidermonkey build bustages as it can be seen here. Same issue though.

[task 2024-07-29T12:58:41.280Z] gmake[3]: Entering directory '/builds/worker/workspace/obj-spider'
[task 2024-07-29T12:58:41.280Z] /builds/worker/.mozbuild/srcdirs/gecko-8a5b87fe5d69/_virtualenvs/build/bin/python -m mozbuild.action.file_generate /builds/worker/checkouts/gecko/config/run_spidermonkey_checks.py main js/src/build/spidermonkey_checks js/src/build/.deps/spidermonkey_checks.pp js/src/build/.deps/spidermonkey_checks.stub js/src/build/libjs_static.a /builds/worker/checkouts/gecko/config/check_spidermonkey_style.py /builds/worker/checkouts/gecko/config/check_macroassembler_style.py /builds/worker/checkouts/gecko/config/check_js_opcode.py
[task 2024-07-29T12:58:41.280Z] --- check_spidermonkey_style.py expected output
[task 2024-07-29T12:58:41.281Z] +++ check_spidermonkey_style.py actual output
[task 2024-07-29T12:58:41.281Z] @@ -46,6 +46,9 @@
[task 2024-07-29T12:58:41.281Z]  js/src/tests/style/BadIncludesOrder-inl.h:28:29: error:
[task 2024-07-29T12:58:41.281Z]      "vm/JSScript.h" should be included after "vm/JSFunction.h"
[task 2024-07-29T12:58:41.281Z] +js/src/vm/Realm.cpp:9:11: error:
[task 2024-07-29T12:58:41.281Z] +    "jsmath.h" should be included after "mozilla/MemoryReporting.h"
[task 2024-07-29T12:58:41.281Z] +
[task 2024-07-29T12:58:41.281Z]  (multiple files): error:
[task 2024-07-29T12:58:41.281Z]      header files form one or more cycles
[task 2024-07-29T12:58:41.281Z] TEST-UNEXPECTED-FAIL | check_spidermonkey_style.py | actual output does not match expected output;  diff is above.
[task 2024-07-29T12:58:41.281Z] TEST-UNEXPECTED-FAIL | check_spidermonkey_style.py | Hint: If the problem is that you renamed a header, and many #includes are no longer in alphabetical order, commit your work and then try `check_spidermonkey_style.py --fixup`. You need to commit first because --fixup modifies your files in place.
[task 2024-07-29T12:58:41.281Z] Traceback (most recent call last):
[task 2024-07-29T12:58:41.281Z]   File "<frozen runpy>", line 198, in _run_module_as_main
[task 2024-07-29T12:58:41.281Z]   File "<frozen runpy>", line 88, in _run_code
[task 2024-07-29T12:58:41.281Z]   File "/builds/worker/checkouts/gecko/python/mozbuild/mozbuild/action/file_generate.py", line 154, in <module>
[task 2024-07-29T12:58:41.281Z]     sys.exit(main(sys.argv[1:]))
[task 2024-07-29T12:58:41.282Z]              ^^^^^^^^^^^^^^^^^^
[task 2024-07-29T12:58:41.282Z]   File "/builds/worker/checkouts/gecko/python/mozbuild/mozbuild/action/file_generate.py", line 98, in main
[task 2024-07-29T12:58:41.282Z]     ret = module.__dict__[method](
[task 2024-07-29T12:58:41.282Z]           ^^^^^^^^^^^^^^^^^^^^^^^^
[task 2024-07-29T12:58:41.282Z]   File "/builds/worker/checkouts/gecko/config/run_spidermonkey_checks.py", line 15, in main
[task 2024-07-29T12:58:41.282Z]     raise Exception(script + " failed")
[task 2024-07-29T12:58:41.282Z] Exception: /builds/worker/checkouts/gecko/config/check_spidermonkey_style.py failed
[task 2024-07-29T12:58:41.282Z] gmake[3]: *** [backend.mk:72: js/src/build/.deps/spidermonkey_checks.stub] Error 1
[task 2024-07-29T12:58:41.282Z] gmake[3]: Leaving directory '/builds/worker/workspace/obj-spider'
[task 2024-07-29T12:58:41.282Z] gmake[3]: Target 'recurse_misc' not remade because of errors.
[task 2024-07-29T12:58:41.282Z] gmake[2]: *** [/builds/worker/checkouts/gecko/config/recurse.mk:34: misc] Error 2
[task 2024-07-29T12:58:41.282Z] gmake[1]: *** [/builds/worker/checkouts/gecko/config/rules.mk:359: default] Error 2
[task 2024-07-29T12:58:41.282Z] gmake: *** [client.mk:60: build] Error 2
[task 2024-07-29T12:58:41.282Z] 72 compiler warnings present.
[task 2024-07-29T12:58:41.395Z]  Config object not found by mach.
[task 2024-07-29T12:58:41.395Z] Configure complete!
[task 2024-07-29T12:58:41.395Z] Be sure to run |mach build| to pick up any changes
[task 2024-07-29T12:58:41.459Z] Traceback (most recent call last):
[task 2024-07-29T12:58:41.459Z]   File "/builds/worker/checkouts/gecko/js/src/devtools/automation/autospider.py", line 454, in <module>
[task 2024-07-29T12:58:41.459Z]     run_command([sys.executable, mach, "build"], check=True)
[task 2024-07-29T12:58:41.459Z]   File "/builds/worker/checkouts/gecko/js/src/devtools/automation/autospider.py", line 376, in run_command
[task 2024-07-29T12:58:41.459Z]     raise subprocess.CalledProcessError(status, command, output=stderr)
[task 2024-07-29T12:58:41.459Z] subprocess.CalledProcessError: Command '['/usr/bin/python3', '/builds/worker/checkouts/gecko/mach', 'build']' returned non-zero exit status 2.
[task 2024-07-29T12:58:41.468Z] + BUILD_STATUS=1
[task 2024-07-29T12:58:41.468Z] + upload=1
[task 2024-07-29T12:58:41.468Z] + '[' -n '' ']'
[task 2024-07-29T12:58:41.468Z] + '[' 1 = 1 ']'
[task 2024-07-29T12:58:41.468Z] + cd /builds/worker/workspace/obj-spider/dist/bin
[task 2024-07-29T12:58:41.468Z] + zip /builds/worker/artifacts/target.jsshell.zip js jsapi-tests js-gdb.py libnspr4.so libplds4.so libplc4.so
[task 2024-07-29T12:58:47.867Z]   adding: js (deflated 67%)
[task 2024-07-29T12:58:54.709Z]   adding: jsapi-tests (deflated 68%)
[task 2024-07-29T12:58:54.709Z]   adding: js-gdb.py (deflated 39%)
[task 2024-07-29T12:58:54.753Z]   adding: libnspr4.so (deflated 60%)
[task 2024-07-29T12:58:54.755Z]   adding: libplds4.so (deflated 72%)
[task 2024-07-29T12:58:54.758Z]   adding: libplc4.so (deflated 68%)
[task 2024-07-29T12:58:54.758Z] + cp -L /builds/worker/workspace/obj-spider/mozinfo.json /builds/worker/artifacts/target.mozinfo.json
[task 2024-07-29T12:58:54.759Z] + '[' -d /builds/worker/fetches/llvm-symbolizer ']'
[task 2024-07-29T12:58:54.759Z] + for f in "$MOZ_FETCHES_DIR/llvm-symbolizer/bin/llvm-symbolizer"*
[task 2024-07-29T12:58:54.759Z] + gzip -c /builds/worker/fetches/llvm-symbolizer/bin/llvm-symbolizer
[task 2024-07-29T12:58:55.063Z] + break
[task 2024-07-29T12:58:55.063Z] + '[' -n 20240729124828 ']'
[task 2024-07-29T12:58:55.063Z] + '[' -n 3c25134b4a3e9dc3e7a390f35aeafa98ee619393 ']'
[task 2024-07-29T12:58:55.063Z] + cat
[task 2024-07-29T12:58:55.064Z] + cp /builds/worker/checkouts/gecko/mozconfig.autospider /builds/worker/artifacts
[task 2024-07-29T12:58:55.065Z] + exit 1
[taskcluster 2024-07-29 12:58:57.855Z] === Task Finished ===
[taskcluster 2024-07-29 12:59:00.024Z] Unsuccessful task run with exit code: 1 completed in 408.354 seconds
Flags: needinfo?(me)
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3d7f25f0240d Add JSAPI for resetting the seed for Math.random(). r=jandem
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: