Skip to content

Liveview crash when saving files quickly #14429

@m1ga

Description

@m1ga

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

Think I've only posted this in an old (90days+ hidden) Slack post where the discussion was to enable Liveview by default.

When you save a file during a restart or save multiple files at once it can happen that the restart will show these errors:

[ERROR] TiExceptionHandler: (main) [29328,29752] /app.js:344
[ERROR] TiExceptionHandler:     return (Module._globalCtx.localeStrings[Ti.Locale.currentLanguage] || {})[name] || filler || name;
[ERROR] TiExceptionHandler:                               ^
[ERROR] TiExceptionHandler: Uncaught TypeError: no access
[ERROR] TiExceptionHandler: L (/app.js:344:31),updateCoordinationLabel (eval at Module._compile (/app.js:727:18), <anonymous>:344:25),Object.callback (eval at Module._compile (/app.js:727:18), <anonymous>:374:9),Geolocation.handleLocation (eval at Module._compile (/app.js:727:18), <anonymous>:86:13),Geolocation.value (ti:/kroll.js:1439:27),Geolocation.value (ti:/kroll.js:1486:25)
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:985)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1219)
[ERROR] TiExceptionHandler:     ti.modules.titanium.geolocation.GeolocationModule.handleMessage(GeolocationModule.java:203)
[ERROR] TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:103)
[ERROR] TiExceptionHandler:     android.os.Looper.loopOnce(Looper.java:232)
[ERROR] TiExceptionHandler:     android.os.Looper.loop(Looper.java:317)
[ERROR] TiExceptionHandler:     android.app.ActivityThread.main(ActivityThread.java:8705)
[ERROR] TiExceptionHandler:     java.lang.reflect.Method.invoke(Native Method)
[ERROR] V8Exception: Exception occurred at /app.js:344: Uncaught TypeError: no access

or

[ERROR] TiExceptionHandler: (main) [1158,1197] ti:/kroll.js:291
[ERROR] TiExceptionHandler:         resolved = (global.process ? process.cwd() : '/') + separator + resolved;
[ERROR] TiExceptionHandler:                         ^
[ERROR] TiExceptionHandler: Uncaught TypeError: no access
[ERROR] TiExceptionHandler: resolve (ti:/kroll.js:291:25),Object.resolve (ti:/kroll.js:545:13),Module.nodeModulesPaths (ti:/kroll.js:1007:24),Module.load (ti:/kroll.js:736:26),Module.loadExternalModule (ti:/kroll.js:827:19),Module.loadCoreModule (ti:/kroll.js:962:24),Module.require (ti:/kroll.js:889:28),Module.global.Module.require (<embedded>:12279:32),Function.require [as _requireNative] (ti:/kroll.js:1171:22),Module._compile (/app.js:722:28),Module.require (/app.js:589:40),Object.exports.post (eval at Module._compile (/app.js:727:10), <anonymous>:24:5),Object.success (eval at Module._compile (/app.js:727:10), <anonymous>:303:11),checkToken (eval at Module._compile (/app.js:727:10), <anonymous>:116:9),Object.myFiles (eval at Module._compile (/app.js:727:10), <anonymous>:301:3),refreshData (eval at Module._compile (/app.js:727:10), <anonymous>:210:14),child.eval (eval at Module._compile (/app.js:727:10), <anonymous>:261:5),triggerEvents (eval at Module._compile (/app.js:727:10), <anonymous>:338:56),triggerApi (eval at Module._compile (/app.js:727:10), <anonymous>:325:19),eventsApi (eval at Module._compile (/app.js:727:10), <anonymous>:113:16),child.Events.trigger (eval at Module._compile (/app.js:727:10), <anonymous>:315:5),Object.Sync [as sync] (eval at Module._compile (/app.js:727:10), <anonymous>:276:51),child.extendObj.sync (eval at Module._compile (/app.js:727:10), <anonymous>:183:18),child.fetch (eval at Module._compile (/app.js:727:10), <anonymous>:1075:19),TabGroup.onOpen (eval at Module._compile (/app.js:727:10), <anonymous>:178:17),TabGroup.value (ti:/kroll.js:1439:27),TabGroup.value (ti:/kroll.js:1486:25)
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:986)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1230)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:258)
[ERROR] TiExceptionHandler:     android.os.Handler.dispatchMessageImpl(Handler.java:138)
[ERROR] TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:125)
[ERROR] TiExceptionHandler:     android.os.Looper.loopOnce(Looper.java:269)
[ERROR] TiExceptionHandler:     android.os.Looper.loop(Looper.java:367)
[ERROR] TiExceptionHandler:     android.app.ActivityThread.main(ActivityThread.java:9333)
[ERROR] V8Exception: Exception occurred at ti:/kroll.js:291: Uncaught TypeError: no access

or

[ERROR] TypeError: no access
[ERROR] File: /alloy/widgets/task/controllers/widget
[ERROR] Line: undefined
[ERROR] SourceId: undefined
[ERROR] Backtrace:
[ERROR] undefined
[ERROR] TiExceptionHandler: (main) [27,1224]   return new (require('/alloy/widgets/' + id + '/controllers/' + (name || DEFAULT_WIDGET)))(args);
[ERROR] TiExceptionHandler:          ^
[ERROR] TiExceptionHandler: Uncaught TypeError: require(...) is not a constructor
[ERROR] TiExceptionHandler: Object.exports.createWidget (eval at Module._compile (/app.js:727:10), <anonymous>:411:10),eval (eval at Module._compile (/app.js:727:10), <anonymous>:247:28),Array.forEach (<anonymous>),readTaskData (eval at Module._compile (/app.js:727:10), <anonymous>:245:20),Window.onOpen (eval at Module._compile (/app.js:727:10), <anonymous>:171:7),Window.value (ti:/kroll.js:1439:27),Window.value (ti:/kroll.js:1486:25)
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:986)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1230)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:258)
[ERROR] TiExceptionHandler:     ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:604)
[ERROR] TiExceptionHandler:     android.os.Handler.dispatchMessageImpl(Handler.java:138)
[ERROR] TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:125)
[ERROR] TiExceptionHandler:     android.os.Looper.loopOnce(Looper.java:269)
[ERROR] TiExceptionHandler:     android.os.Looper.loop(Looper.java:367)
[ERROR] V8Exception: Exception occurred at undefined:411: Uncaught TypeError: require(...) is not a constructor

According to AI it's

The error occurs due to a race condition during LiveView's softRestart():
1. Normal flow: LiveView detects file changes → calls TiApplication.softRestart() 
2. Disposal phase (line 929): runtime.doDispose() synchronously disposes the V8 runtime, resetting all V8 handles (globalContext, moduleObject, etc.)
3. Transition window: Between doDispose() and initRuntime() (line 930), the V8 handles are invalid but the Java thread continues running
4. Race: A geolocation callback fires on the main thread during this window
5. Crash: The callback executes JS code → Ti.Locale.getString() → accesses Module._globalCtx.localeStrings → V8 "no access" error
The root cause is that nativeFireEvent in V8Object.cpp has no guard to check if the runtime is disposed/in transition.

Note: it's not just Ti.Locale.

Tried to fix it with AI but no solution yet. Maybe one other solution would be to queue the changes and not apply then until the app is fully ready again?

How to test it:
open a bigger project using liveview and save a file quickly.

Expected Behavior

Actual behavior

Reproducible sample

Steps to reproduce

Platform

Android

SDK version you are using

13.2.0.GA

Alloy version you are using

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triageThis issue hasn't been reviewed by maintainers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions