Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23671] Receiving "Segmentation fault: 11" when trying to build after updating SDK to 5.4.0 from June 6 (or later)

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-08-04T16:36:26.000+0000
Affected Version/sn/a
Fix Version/sioslib 0.12.0, node-ios-device 0.10.0, node-ios-device 0.10.1, node-ios-device 0.11.0, ioslib 0.13.0, Release 5.5.0, node-ios-device 0.11.1, node-ios-device 0.11.2, node-ios-device 1.0.0
ComponentsiOS, Tooling
Labelsn/a
ReporterDaniel Pfeiffer
AssigneeChris Barber
Created2016-06-07T20:15:54.000+0000
Updated2018-08-06T17:49:29.000+0000

Description

Attachments

FileDateSize
ac3802.mp42016-06-10T17:42:30.000+00008726725

Comments

  1. Daniel Pfeiffer 2016-06-07

    It seems like if I restart my computer, it will work once. Then seg fault each time after that.
  2. Daniel Pfeiffer 2016-06-07

    I have tried uninstalling the Titanium CLI and removing the SDK, then reinstalling both, but the issue persists.
  3. Daniel Pfeiffer 2016-06-07

    Didn't realize there was a problem template. Updating description.
  4. Nazmus Salahin 2016-06-09

    Hello, Things working as expected in my environment for SDK 6.0.0.v20160608170004. I have tried following commands.
       appc ti sdk install --branch master 6.0.0.v20160608170004
       appc ti sdk select 6.0.0.v20160608170004
       appc ti build
       
    *CLI OUTPUT:*
       $ appc ti sdk select 6.0.0.v20160607075329
       Appcelerator Command-Line Interface, version 5.2.2
       Copyright (c) 2014-2016, Appcelerator, Inc.  All Rights Reserved.
       
       [ERROR] Invalid Titanium SDK "6.0.0.v20160607075329"
       
       Installed SDKs:
          1)  6.0.0.v20160608170004 [selected]  C:\ProgramData\Titanium\mobilesdk\win32\6.0.0.v20160608170004
          2)  5.4.0.v20160509133737             C:\ProgramData\Titanium\mobilesdk\win32\5.4.0.v20160509133737
          3)  5.4.0.v20160429102159             C:\ProgramData\Titanium\mobilesdk\win32\5.4.0.v20160429102159
          4)  5.4.0.v20160405161149             C:\ProgramData\Titanium\mobilesdk\win32\5.4.0.v20160405161149
          5)  5.3.0.v20160404105211             C:\ProgramData\Titanium\mobilesdk\win32\5.3.0.v20160404105211
          6)  5.3.0.GA                          C:\ProgramData\Titanium\mobilesdk\win32\5.3.0.GA
          7)  5.2.2.GA                          C:\ProgramData\Titanium\mobilesdk\win32\5.2.2.GA
          8)  5.2.1.GA                          C:\ProgramData\Titanium\mobilesdk\win32\5.2.1.GA
          9)  5.2.0.GA                          C:\ProgramData\Titanium\mobilesdk\win32\5.2.0.GA
         10)  5.1.2.GA                          C:\ProgramData\Titanium\mobilesdk\win32\5.1.2.GA
         11)  4.0.0.GA                          C:\ProgramData\Titanium\mobilesdk\win32\4.0.0.GA
       Titanium SDK version to select [6.0.0.v20160608170004]:
       
       Configuration saved
       
       
       Titanium@GSL /e/AppceleretorWorkspace/ac3800
       $ appc ti build
       Appcelerator Command-Line Interface, version 5.2.2
       Copyright (c) 2014-2016, Appcelerator, Inc.  All Rights Reserved.
       
       Target platform to build for:
        1)  android
        2)  mobileweb
        3)  windows
       Enter # or platform name: 1
       
       6/9/2016, 3:25:19 PM
       
       Operating System
         Name                        = Microsoft Windows 8.1 Enterprise N
         Version                     = 6.3.9600
         Architecture                = 32bit
         # CPUs                      = 4
         Memory                      = 6311747584
       
       Node.js
         Node.js Version             = 0.12.7
         npm Version                 = 2.11.3
       
       Titanium CLI
         CLI Version                 = 5.0.6
       
       Titanium SDK
         SDK Version                 = 6.0.0.v20160608170004
         SDK Path                    = C:\ProgramData\Titanium\mobilesdk\win32\6.0.0.v20160608170004
         Target Platform             = android
       
    *Environment*: *Device info:* Nexus7 (android 6.0.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 6.0.0.v20160608170004 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.6 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0
  5. Daniel Pfeiffer 2016-06-10

    Thanks, Nazmus. Unfortunately, I'm still experiencing issues. I'm attaching a short screen capture. Using the SDK you mention, I get segmentation fault errors when trying to do _anything_ with ti build. Even just pull up the help documentation. However, if I switch to an older SDK version, it seems to be okay (it still doesn't build because it forks the new SDK, but I can run the help command). [^ac3802.mp4]
  6. Daniel Pfeiffer 2016-06-10

    FWIW, I have Titanium on multiple machines, and they all behave a bit differently: On my main machine, it segfaults almost always. If I reboot, sometimes it will work once. On my build machine, it seems to work just fine. On a coworker's machine, it seems to be 50/50. Sometimes it segfaults, sometimes it doesn't. If he cleans a number of times, then it usually works. And this all started within the past few days. Before June 6, everything worked fine. As far as I know, we all have the same development environment and it hasn't changed in the past week.
  7. Sharif AbuDarda 2016-06-10

    Hello, Does this only happens to master releases or for GA releases too?
  8. Daniel Pfeiffer 2016-06-10

    I don't think I have access to GA releases (I'm using the builds from http://builds.appcelerator.com/). So--I've only tried on master releases (and more recent releases from 5.4.x branch).
  9. Nazmus Salahin 2016-06-12

    Hello [~dpfeiffer], Try installing latest GA release with following command and then try building apps with this SDK.
       appc ti sdk install 5.3.0.GA
       
    Also please give us your environment details. You can get that with following command.
       appc info
       
    Thanks in advance
  10. Wilson Luu 2016-07-15

    So far, we are unable to reproduce this issue internally. We tried the following: * Switch node version using the n node module; 0.12.5, 4.4.5, 4.4.7 * Used both Titanium CLI (5.0.8, 5.0.9) and Appc CLI (5.3.1, 5.4.0-31, 5.4.0-33) to create and build a mobile project (appc new, appc run, ti create, ti build, appc ti build) * Used Titanium SDK 5.3.1.GA, 5.4.0.v20160713141635, 6.0.0.v20160607075329 * And used Xcode 7.3.1 Below are the listed steps we tried: *Possible steps with Appc CLI only:*

    Download and install n node module

    Use n to switch node 0.12.5 from node 4.4.7: sudo n 0.12.5

    Install Titanium SDK 5.3.1.GA: appc ti sdk install 5.3.1.GA

    *Note:* A message will appear saying it will recompile the Appc CLI Core if you installed Appc CLI Core with Node greater than 0.12.X.

    Created a mobile project with: appc new

    Run the project with: appc run -p ios; no issue

    Using n node module, switch to node 4.4.7: sudo n 4.4.7

    Clean same mobile project: appc ti clean

    *Note:* A message will appear saying it will recompile the Appc CLI Core.

    Install and select latest 5.4.0 SDK

    Changed SDK in tiapp.xml to selected version

    Run and build again: appc run -p ios; no issue

    *Possible steps with Titanium CLI only:*

    Download and install n node module

    Use n to switch node 0.12.5 from node 4.4.7: sudo n 0.12.5

    Install Titanium SDK 5.3.1.GA: ti sdk install 5.3.1.GA

    Created a mobile project with: ti create

    Run the project with: ti build -p ios; no issue

    Using n node module, switch to node 4.4.7: sudo n 4.4.7

    Clean same mobile project: ti clean

    Install and select latest 5.4.0 SDK

    Changed SDK in tiapp.xml to selected version

    Run and build again: ti build -p ios; no issue

  11. Daniel Pfeiffer 2016-07-18

    Thanks, Wilson. We rolled back to the 5.3.1GA and haven't been having these issues. However, when we tried to preview the latest continuous integration builds (like the ones mentioned in the description), the seg faults are introduced.
  12. Wilson Luu 2016-07-18

    [~dpfeiffer], Couple of things:

    Which Xcode version you are using?

    Which Android SDK, Platform, and Build tools are you using? Android NDK?

    Can you try using https://www.npmjs.com/package/segfault-handler to capture more detailed information on the seg fault?

    In terminal, go to the location of your *selected* SDK e.g. cd ~/Library/Application Support/Titanium/mobilesdk/osx/6.0.0.v20160718080315

    Install segfault-handler node module: npm install segfault-handler

    Next, open the build.js file; go to: <PATH_TO_SDK>/cli/commands/build.js

    Include the following lines of code at the top of the build.js file:

        var SegfaultHandler = require('segfault-handler');
        SegfaultHandler.registerHandler('crash.log');
        

    Save your changes and reproduce your issue; the crash.log file will be generated where ever you run the build command

  13. Rodolfo Perottoni 2016-07-20

    Can someone open this ticket again? I've just got this error showing up for me and don't know what else to do. I've tried: - Uninstalling APPC CLI / Titanium CLI and installing again - Using multiple versions of Ti SDK / APPC CLI / Titanium CLI - Trying to build all of my previous projects (many different versions of SDK): none works - Building via Studio / Command line - none works This problem started since 5.4.0.v20160617074028. Previously i was having to run "ti build " a few times and after a while it would start working again, but today (20/Jul) it stopped for real. I ran out of options here guys. Should i reset my Mac to factory defaults now ?
  14. Rodolfo Perottoni 2016-07-20

    I'm starting to think this is not a local problem. Reasons? -> It started after i logged in with a Pro account and tried to build a hyperloop-enabled project -> I've uninstalled APPC CLI, Titanium CLI, NodeJS, all SDKs. Then i've also deleted all hidden folders on my local User folder (*.appcelerator*, *.titanium*) -> I've reinstalled everything from scratch. I still can't run any projects with that account. -> My colleague tried logging into the same account on another computer. He can't build any projects with it as well. It's very unlikely that you guys will be able to replicate this issue easily. If you still can't, i can provide the example project and the details of my account so you can log into it and look at that error. Thanks guys.
  15. Rodolfo Perottoni 2016-07-20

    Just tried using 5.3.1.GA with a project that *does not have hyperloop*. Works like a charm. If i change it to run with 5.4.0+, it stops working.
  16. Francisco Ruaro Varisco 2016-07-20

    The only 5.4.X SDK version that runs some Hyperloop project is the v20160413200113. Still not the best scenario as this versions has a bunch of bugs. I'm suspecting the issue is something related to the accounts check (If you have a PRO account or not)
  17. Wilson Luu 2016-07-20

    [~rdperottoni], [~xicovarisco_orange], Can you try adding the segfault-handler node module (see my last comment) and see if you can capture more detailed information about the segfault? [~rdperottoni], Yes, please attach your project that is showing this issue.
  18. Daniel Pfeiffer 2016-07-20

    1. Xcode 7.3.1. 2. Android SDK 23; build tools 23; NDK r10d 3. The entirety of the crash.log is below: {noformat} PID 8549 received SIGSEGV for address: 0x0 0 segfault-handler.node 0x00000001016f0fe8 _ZL16segfault_handleriP9__siginfoPv + 280 1 libsystem_platform.dylib 0x00007fff83ac252a _sigtramp + 26 2 ??? 0x00000000000007a1 0x0 + 1953 3 node_ios_device.node 0x000000010438e441 _ZL13getDeviceInfoP6Device + 357 4 node_ios_device.node 0x0000000104397daf _ZNSt3__114__thread_proxyINS_5tupleIJPFvP6DeviceES3_EEEEEPvS7_ + 62 5 libsystem_pthread.dylib 0x00007fff87e6299d _pthread_body + 131 6 libsystem_pthread.dylib 0x00007fff87e6291a _pthread_body + 0 7 libsystem_pthread.dylib 0x00007fff87e60351 thread_start + 13 {noformat} This is the same log regardless of whether I build for Android or iOS.
  19. Wilson Luu 2016-07-20

    [~dpfeiffer], Still can't reproduce the issue with your Xcode and Android stack. *But,* the seg fault log that you provided seems interesting. The log indicates that the iOS issue may lie within the node-ios-device node module. For Android, not too sure still. To confirm the iOS issue:

    Go to your 5.3.1.GA SDK and copy ioslib node module e.g.: ~/Library/Application Support/Titanium/mobilesdk/osx/5.3.1.GA/node_modules

    In your selected SDK that's generating the seg fault, *attach* the ioslib node module to this ticket, then delete and replace it with the one from 5.3.1.GA SDK. e.g. ~/Library/Application Support/Titanium/mobilesdk/osx/<SELECTED_SDK>/node_modules

    Next, edit the package.json to contain the correct ioslib version e.g. : ~/Library/Application Support/Titanium/mobilesdk/osx/<SELECTED_SDK>/package.json. The ioslib version from 5.3.1.GA SDK should be 0.10.4

    Try to reproduce

  20. Chris Barber 2016-07-21

    This error has nothing to do with Android, so we can ignore it. It's nice to have captured the segfault info. It only verifies that node-ios-device is the culprit. node-ios-device is the only native code that Node calls in the entire Titanium CLI or Titanium build. The version of node-ios-device in 5_4_X and master branches is v0.9.5 which had significant internal changes. There were fixes for race conditions, Node 6 support, updated Boost version, and node-pre-gyp. It's likely that a regression has been introduced. OK, so looking at the segfault stack, we see that node_ios_device.node choked on something after _ZL13getDeviceInfoP6Device. node-ios-device is open source, so you could easily look up that function to see what's going on: https://github.com/appcelerator/node-ios-device/blob/master/src/ios-device.cpp#L198. getDeviceInfo() is run on a background thread. getDeviceInfo() has a shared mutex so that we only query a single device at a time. The shared mutex instance is from Boost. Boost is mostly headers, but does require two precompiled static libraries: libboost_system-mt.a and libboost_thread-mt.a. The precompiled Boost libraries are in the deps folder of node-ios-device: https://github.com/appcelerator/node-ios-device/tree/master/deps/boost/lib. I had issues compiling Boost so I cheated and installed them via MacPorts. I have no idea how exactly those were compiled. It's possible they were compiled against a library or with some configuration that causes the segfault at runtime. I propose I update the Boost dependencies by recompiling them, then recompile node-ios-device and publish a v0.9.6. Then update ioslib and Titanium SDK's 5_4_X and master branch with the latest ioslib and node-ios-device. I'm hoping that will fix the problem.
  21. Daniel Pfeiffer 2016-07-21

    Thanks, Chris. Wilson--do you still need me to try and reproduce by swapping out the ioslib module? It seems like the source of the issue is pretty clear (although maybe not the cause yet).
  22. Wilson Luu 2016-07-21

    [~dpfeiffer], No, I think we're good. Thanks for the assist :)
  23. Chris Barber 2016-07-26

    node-ios-device PR: https://github.com/appcelerator/node-ios-device/pull/17
  24. Chris Barber 2016-07-28

    I've published node-ios-device 0.10.1 which should solve the seg fault and address an issue where node-ios-device would hang due to what I believe is a deadlock. I'll be publishing a new version of ioslib shortly and updating Titanium SDK.
  25. Rodolfo Perottoni 2016-08-01

  26. Chris Barber 2016-08-01

    [~rdperottoni] You can save your time. I have already fixed the seg fault issue. Unfortunately, I uncovered 2 other issues related to the run loops and deadlocks. I'm actively working on a fix.
  27. Rodolfo Perottoni 2016-08-01

    @Chris Barber i've seen the PR, but i'm just curious to know why node-ios-device is called even when you're trying to build the project for Android platform... any clue ? Oh, and by the way: is there any way we can use that latest node-ios-version you published before a new SDK version ? Thanks.
  28. Chris Barber 2016-08-01

    [~rdperottoni] Good question! Basically the Titanium CLI doesn't know anything about the "build" command. It identifies the command is "build", then loads it. Upon loading it, it calls the build command's config() handler which returns the build command flags, options, subcommands, and platform specific build command config settings. This means each platform has to return its options and subsequent values so the CLI can validate them. In order to get the values, it needs to query the iOS development environment. This makes things nice when doing ti build -h or when building from the CLI and it prompts you for a missing or invalid option. We are working on overhauling the CLI which would resolve this issue and speed things up drastically, but that's a ways off. We don't support updating node-ios-device in a Titanium SDK. I hesitate to even tell you how to do it being that the latest published node-ios-device is flawed. I ask that you please wait until I'm able to fix it.
  29. Rodolfo Perottoni 2016-08-01

    Thanks for the explanation :). Yeah, i've tried installing 0.10.1 through *npm*, but i'm still getting the error. I'll just wait for the fix then. Thanks for the help so far mate.
  30. Chris Barber 2016-08-04

    I've finished fixing all the bugs and design flaws with node-ios-device. PR: https://github.com/appcelerator/node-ios-device/pull/20 Need to do more testing. I published a beta build: node-ios-device@0.11.0-beta. If it looks good, I'll publish the v0.11.0 and updating ioslib and Titanium SDK.
  31. Chris Barber 2016-08-04

    Just did some testing and node-ios-device v0.11.0 works like a champ. Published to v0.11.0 to NPM. Here's the PR for ioslib: https://github.com/appcelerator/ioslib/pull/39 ioslib v0.13.0 published.
  32. Chris Barber 2016-08-04

    Here's the PR for Titanium SDK master: https://github.com/appcelerator/titanium_mobile/pull/8191
  33. Chris Barber 2016-08-15

    5_5_X PR https://github.com/appcelerator/titanium_mobile/pull/8229
  34. Josh Longton 2016-08-19

    [~rdperottoni] Would you be able to confirm this fix works for you, I am unable to reproduce the issue in order to verify it.
  35. Rodolfo Perottoni 2016-08-24

    I'll try this afternoon. Please note that this error occurred very sporadically, so i'm not sure if i will be able to give an answer soon.
  36. Eric Merriman 2018-08-06

    Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.

JSON Source