Skip to content

New fatal errors in scipy tests on main branch #4249

@lesteve

Description

@lesteve

🐛 Bug

There are new tests with fatal errors in the scipy tests from https://github.com/lesteve/scipy-tests-pyodide.

Last working commit (2 days ago): 408bffb
First broken commit (yesterday): 429dcd4

❯ git l 408bffb7..429dcd4b 
* 429dcd4b - Use externrefs for some ffi code (2) (#4226) (2 days ago) <Hood Chatham>
* 2d55a3e7 - xfail syncify_not_supported in node (2 days ago) <Hood Chatham>
* 7a7691c2 - Make jspi work correctly with nodylink builds (2 days ago) <Hood Chatham>
* 4bafdafc - Update JSPI patch for Emscripten 3.1.45 (2 days ago) <Hood Chatham>
* 6117d7c9 - Stack switching (#3210) (2 days ago) <Hood Chatham>
* d97eaa58 - Use branch in macro to choose trampoline (#3990) (2 days ago) <Hood Chatham>
* 31c1345a - Move stack switching logic into a new stack switching folder. (#3987) (2 days ago) <Hood Chatham>
* c931b06a - Patch CPython to use a type reflection trampoline if possible (#3964) (2 days ago) <Hood Chatham>
* 3085cb9d - Use Wasm Exceptions for invoke stubs if they exist (#3957) (2 days ago) <Hood Chatham>

Full log is here. Error seem similar to the ones in #4140 when the JSPI changes were reverted.

Here are the submodules with issue (below are the stacktraces from the log):

--------------------------------------------------------------------------------
Unexpected test results
--------------------------------------------------------------------------------
scipy.fft.tests result expected in ['passed'], got 'fatal error or timeout' instead
scipy.optimize.tests result expected in ['failed'], got 'fatal error or timeout' instead
scipy.sparse.linalg._dsolve.tests result expected in ['passed'], got 'fatal error or timeout' instead
scipy.special.tests result expected in ['failed'], got 'fatal error or timeout' instead
scipy.stats.tests result expected in ['failed'], got 'fatal error or timeout' instead

scipy.fft.tests

The cause of the fatal error was:
RuntimeError: Aborted(). Build with -sASSERTIONS for more info.
    at abort (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:651:15)
    at _abort (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:16651:7)
    at pyodide.asm.wasm.fatal_error_exit (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[3803]:0x2bc266)
    at pyodide.asm.wasm.fatal_error (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[3788]:0x2b143a)
    at pyodide.asm.wasm._Py_FatalErrorFunc (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[3801]:0x2bc004)
    at pyodide.asm.wasm._Py_FatalError_TstateNULL (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[3201]:0x260659)
    at pyodide.asm.wasm.PyThreadState_Get (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[3848]:0x2c0bf0)
    at pyodide.asm.wasm.tupledealloc (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[2383]:0x1f4781)
    at pyodide.asm.wasm._Py_Dealloc (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[2186]:0x1e9ed9)
    at pyodide.asm.wasm._PyObject_MakeTpCall (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[1085]:0x1a3722) {
  pyodide_fatal_error: true
}

scipy.optimize.tests

RuntimeError: memory access out of bounds
    at pyodide.asm.wasm.__get_exception_message (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[12687]:0x4d0c6f)
    at Module.___get_exception_message (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:94457:48)
    at /home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:8214:9
    at withStackSave (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:7880:17)
    at getExceptionMessageCommon (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:8211:7)
    at Object.getExceptionMessage (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:8227:40)
    at convertCppException (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5633:31)
    at API.fatal_error (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5647:48)
    at API.maybe_fatal_error (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5685:17)
    at Module.callPyObjectKwargs (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:4349:17)

scipy.sparse.linalg._dsolve.tests

RuntimeError: memory access out of bounds
    at pyodide.asm.wasm.__get_exception_message (wasm://wasm/pyodide.asm.wasm-025c25ae:wasm-function[12687]:0x4d0c6f)
    at Module.___get_exception_message (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:94457:48)
    at /home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:8214:9
    at withStackSave (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:7880:17)
    at getExceptionMessageCommon (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:8211:7)
    at Object.getExceptionMessage (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:8227:40)
    at convertCppException (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5633:31)
    at API.fatal_error (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5647:48)
    at API.maybe_fatal_error (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5685:17)
    at Module.callPyObjectKwargs (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:4349:17)

scipy.special

CppException boost::wrapexcept<std::domain_error>: Error in function boost::math::erf_inv<double>(double, double): Argument outside range [-1, 1] in inverse erf function (got p=-10).
    at convertCppException (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5634:18)
    at API.fatal_error (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5647:48)
    at API.maybe_fatal_error (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5685:17)
    at Module.callPyObjectKwargs (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:4349:17)
    at Module.callPyObject (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:4398:25)
    at Qe.apply (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5395:22)
    at Object.apply (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/node_modules/pyodide/pyodide.asm.js:5277:22)
    at main (/home/runner/work/scipy-tests-pyodide/scipy-tests-pyodide/scipy-pytest.js:56:24) {
  ty: 'boost::wrapexcept<std::domain_error>',
  pyodide_fatal_error: true
}

scipy.stats

no traceback in the log for some reason

To Reproduce

I can post more details if needed but using https://github.com/lesteve/scipy-tests-pyodide will reproduce.

An example Python code that shows the issue (fatal error on main and return nan in stable):

import numpy as np
from scipy.special import powm1
powm1(np.nan, 1)

Expected behavior

No error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions