Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24642] TiAPI: Require call in a node_modules directory causes infinite loop

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-05-10T18:53:51.000+0000
Affected Version/sRelease 6.0.3
Fix Version/sRelease 6.1.0
ComponentsAndroid, iOS
Labelsn/a
ReporterEwan Harris
AssigneeEwan Harris
Created2017-04-28T21:12:02.000+0000
Updated2017-05-10T20:32:23.000+0000

Description

Description

When a module that resides in node_modules requires another module, an infinite loop will occur and the app will never load and will stay hung on the splash screen Demo app is at https://www.dropbox.com/s/m4wy91x92gxw63m/demo.zip?dl=0 I believe this only happens on iOS and Android,-I have not got round to trying Windows out yet but reviewing the code it looks like this wont happen.-, Windows does not show this exact behavior, but instead fails with
-- Start application log -----------------------------------------------------
[ERROR] ----- Titanium Javascript Runtime Error -----
[ERROR] In /node_modules/foo/lib/foo.js: 3,18
[ERROR] Message: Uncaught Error: require: Could not load module bar

Steps to reproduce

Build the attached application for android or iOS

Actual result

App stays hung on the splash screen

Expected

App should load. Currently it throws an error, I believe this is because of another bug in the implementation, will file more tickets accordingly

Comments

  1. Ewan Harris 2017-05-08

    master PR: https://github.com/appcelerator/titanium_mobile/pull/9030 6_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/9045 If you want to check out the Android implementation easier, use this https://repl.it/HmCE/3 Testing steps: 1. Download the test app linked in the ticket description 2. Build the app, it should load to a yellow screen and in the console you should see.
       [INFO]  boz index.js loaded
       [INFO]  boo boo.js loaded
       [INFO]  baz index.js loaded
       [INFO]  bar bar.js loaded
       [INFO]  foo lib/foo.js loaded
       [INFO]  foo index.js loaded
       
  2. Abir Mukherjee 2017-05-10

    Passed FR! Node Version: 6.10.1 NPM Version: 3.10.10 Mac OS: 10.12.4 Appc CLI: 6.2.0 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.2.0.v20170510080439, 6.1.0.v20170510103244 (from PR's) Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.3.2 First tested with 6.0.4.GA. The app hangs. I retried with the fix in this PR, and the app launched and displayed a yellow window. FR passed. I tested this on devices iOS 10.3 and Android 7.1.2. Changes are seen in the following SDK (hence closing this ticket): 6.1.0.v20170510115828 6.2.0.v20170510122219

JSON Source