[TIMOB-23671] Receiving "Segmentation fault: 11" when trying to build after updating SDK to 5.4.0 from June 6 (or later)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-04T16:36:26.000+0000 |
Affected Version/s | n/a |
Fix Version/s | ioslib 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 |
Components | iOS, Tooling |
Labels | n/a |
Reporter | Daniel Pfeiffer |
Assignee | Chris Barber |
Created | 2016-06-07T20:15:54.000+0000 |
Updated | 2018-08-06T17:49:29.000+0000 |
Description
Attachments
File | Date | Size |
---|---|---|
ac3802.mp4 | 2016-06-10T17:42:30.000+0000 | 8726725 |
It seems like if I restart my computer, it will work once. Then seg fault each time after that.
I have tried uninstalling the Titanium CLI and removing the SDK, then reinstalling both, but the issue persists.
Didn't realize there was a problem template. Updating description.
Hello, Things working as expected in my environment for SDK
6.0.0.v20160608170004
. I have tried following commands.*CLI OUTPUT:*
*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
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]
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.
Hello, Does this only happens to master releases or for GA releases too?
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).
Hello [~dpfeiffer], Try installing latest GA release with following command and then try building apps with this SDK.
Also please give us your environment details. You can get that with following command.
Thanks in advance
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:
*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.appc ti sdk install 5.3.1.GA
Created a mobile project with:
appc new
Run the project with:
appc run -p ios
; no issueUsing n node module, switch to node 4.4.7:
sudo n 4.4.7
Clean same mobile project:
*Note:* A message will appear saying it will recompile the Appc CLI Core.appc ti clean
Install and select latest 5.4.0 SDK
Changed SDK in tiapp.xml to selected version
Run and build again:
*Possible steps with Titanium CLI only:*appc run -p ios
; no issueDownload 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 issueUsing 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 issueThanks, 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.
[~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:Save your changes and reproduce your issue; the
crash.log
file will be generated where ever you run the build commandCan 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
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.
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.
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)
[~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.
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.
[~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 correctioslib
version e.g. :~/Library/Application Support/Titanium/mobilesdk/osx/<SELECTED_SDK>/package.json
. Theioslib
version from 5.3.1.GA SDK should be 0.10.4Try to reproduce
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
andlibboost_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.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).[~dpfeiffer], No, I think we're good. Thanks for the assist :)
node-ios-device PR: https://github.com/appcelerator/node-ios-device/pull/17
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.
[~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.
@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.
[~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 doingti 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.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.
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.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.
Here's the PR for Titanium SDK master: https://github.com/appcelerator/titanium_mobile/pull/8191
5_5_X PR https://github.com/appcelerator/titanium_mobile/pull/8229
[~rdperottoni] Would you be able to confirm this fix works for you, I am unable to reproduce the issue in order to verify it.
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.
Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.