SIGSEGV stack overflow in volta::react::Utils::nativeTypeFromValue (libkeplerscript-2.so.2)

:warning: Before you continue


Before submitting a bug report, please review our troubleshooting documentation at Troubleshoot Issues | Vega Troubleshooting

If you still want to file a bug report, please make sure to fill in all the details below and provide the necessary information.

NOTE: PLEASE ONLY REPORT A SINGLE BUG USING THIS TEMPLATE.
If you’re experiencing multiple issues, please file a separate report for each.


:backhand_index_pointing_right: Bug Description


1. Summary

Calling setTimeout(func, delay, arg) where arg is an object containing circular references causes an infinite recursion in volta::react::Utils::nativeTypeFromValue (libkeplerscript-2.so.2), resulting in a stack overflow and SIGSEGV crash on the JS thread.

The Vega MCP server was very helpful in determining the root cause. We have a current workaround, but wanted to report the issue.

App Name:
App Link on Amazon Appstore (found through Developer Console → Actions column in App List → View on Amazon.com):

Bug Severity
Select one that applies

  • Impacts operation of app
  • Blocks current development
  • Improvement suggestion
  • Issue with documentation (If selected, please share the doc link and describe the issue)
  • Other

2. Steps to Reproduce

  1. Start video playback with Shaka Player

  2. Add the following event listener to a Shaka player instance after it has loaded a manifest:

  3. // After shaka player has loaded content:
    
    player.addEventListener('trackschanged', (event) => {
    
    // This crashes — the event object has circular references
    
    // (event.target → player → listeners → handler → ...)
    
    // and setTimeout passes it through the native bridge where
    
    // nativeTypeFromValue recurses infinitely trying to serialize it.
    
    setTimeout(() => {
    
    console.log('tracks changed');
    
    }, 25, event);  // ← passing event as extra setTimeout arg triggers crash
    
    });
    
  4. This can be reproduced with any object containing a circular reference:

    // Create an object with a circular reference
    const obj: any = { name: ‘test’ };
    obj.self = obj; // circular reference
    // This will crash with SIGSEGV
    setTimeout(() => {
    console.log(‘callback’);
    }, 100, obj);

3. Observed Behavior

Explain what actually happened, noting any discrepancies or malfunctions.

SIGSEGV app crash

4. Expected Behavior

Describe what you expected the SDK to do under normal operation.

setTimeout should either:

Store extra arguments as opaque JS references (without serializing/traversing them), or
Detect circular references in nativeTypeFromValue and handle them gracefully (e.g., skip, truncate, or throw a JS exception)

4.a Possible Root Cause & Temporary Workaround

Fill out anything you have tried. If you don’t know, N/A is acceptable

CrashLang: Native
CrashReason: SIGSEGV
CrashDescriptor: 29c006260e29b2e85195c1db2066ad93
#0  libhermes-0.12.0.so.0.12.0
#1  libhermes-0.12.0.so.0.12.0
...
#8  libreact-native-0.72.so.0.72
#9  volta::react::Utils::nativeTypeFromValue(...) — libkeplerscript-2.so.2
#10 volta::react::Utils::nativeTypeFromValue(...) — libkeplerscript-2.so.2
... (90+ identical recursive frames)

Workaround: Wrap the function call in a closure so the complex object stays in JS scope and is never passed through the native bridge.

// Instead of:
setTimeout(func, delay, event);
// Use:
setTimeout(() => func(event), delay);

5. Logs or crash report

(Please make sure to provide relevant logs as attachment)

62_JSThread2.acr (511.2 KB)

63_JSThread.acr (514.2 KB)

For crash issues, please refer this guide for faster troubleshooting: Detect Where the App Crash Originates | Design and Develop Vega Apps

  • App/Device Logs

  • Crash Logs

  • Crash Report

  • For issues with Vega Studio Extension, please share log files from below folders:
    For v0.22+:

    ~/.vscode/extensions/amazon.vega-extension-<version>/ExtensionLogs
    ~/.vscode/extensions/amazon.vega-ui-extension-<version>/ExtensionLogs
    

    For v0.21 and earlier:

     ~/.vscode/extensions/amazon.kepler-extension-<version>/ExtensionLogs
     ~/.vscode/extensions/amazon.kepler-ui-extension-<version>/ExtensionLogs
    

6. Environment

Please fill out the fields related to your bug below:

  • SDK Version: 0.22.6150

  • App State: [Foreground]

  • OS Information: Please ssh into the device via vega exec vda shell (or kepler exec vda shell for v0.21 and earlier) and copy the output from cat /etc/os-release into the answer section below. Note, if you don’t have a simulator running or device attached, the command will respond with vda: no devices/emulators found

    NAME="OS"
    OE_VERSION="4.0.0"
    OS_MAJOR_VERSION="1"
    OS_MINOR_VERSION="1"
    RELEASE_ID="14"
    OS_VERSION="1.1"
    BRANCH_CODE="TV Ship day60"
    BUILD_DESC="OS 1.1 (TV Ship day60/101)"
    BUILD_FINGERPRINT="4.0.249302.0(3072cab629675a74)/101N:user/release-keys"
    BUILD_VARIANT="user"
    BUILD_TAGS="release-keys"
    BUILD_DATE="Sat Mar 14 22:24:12 UTC 2026"
    BUILD_TIMESTAMP="1773527052"
    VERSION_NUMBER="1401010010120"
    

7. Example Code Snippet / Screenshots / Screengrabs

Include any relevant code or component setup in React Native that can help reproduce the bug.

see above

:backhand_index_pointing_right: Playback Issues


If this is a playback issue, please provide your content URL, any pre-conditions (like geo-location), and let us know if it’s x86 or arm7.


see above

Please share the following details in addition:_

  • Player SDK: [Shaka]
  • Player SDK Version: [4.8.5]
    • Audio Codecs: [AAC]
    • Video Codecs: [h.264]
    • Manifest Types: [m3u8, dash]

Q: If applicable, please provide your media/content url
If this is created dynamically, tokenized, etc please provide a way for us to access it

[N/A or Content / Media Url for testing]

Q: Are there any special headers required to reproduce the issue you are facing?

[N/A or Insert Headers]

Additionally please provide the following if possible
Provide Screenshots / Screengrabs / Logs. Please include as much information as you can that will help debug.

<!-- Answer here if applicable --> 

:backhand_index_pointing_right: Additional Context


Any Additional Context you would like to provide?
Add any other relevant information, such as recent updates to the SDK, dependencies, or device OS that may affect the bug.

<!-- Answer here if applicable  --> 

Hi @will.harris,

Thank you for the detailed bug report on the setTimeout circular reference issue and for working with the Vega MCP server to identify the root cause.

Our team is investigating this issue and will provide an update as soon as we have more information.

We appreciate the workaround you’ve shared - it will be helpful for other developers who may encounter similar issues.

Thanks for helping us improve the Vega platform.

Warm regards,
Aishwarya