Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13849] LiveView: Alloy project files emptied of contents in error condition where multiple node processes are spawned

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-06-19T17:22:50.000+0000
Affected Version/sRelease 3.1.1
Fix Version/s2013 Sprint 13 JS, 2013 Sprint 13, Release 3.1.2, Release 3.2.0
ComponentsLiveView
Labelsqe-3.1.1
ReporterEric Merriman
AssigneeChristian Sullivan
Created2013-05-14T00:01:59.000+0000
Updated2014-04-22T10:07:58.000+0000

Description

Description:

While attempting to recreate the issue where the combination of Alloy and Liveview produces hundreds of node processes, I noticed after a few attempts that my files where still there but the content was gone. I thought this might be related to me running "killall node" when the processes started to multiply, but Matt had experienced this as well and did not use this technique.

Steps to reproduce:

Steps to reproduce are difficult since this might be related to the repro steps of the other bug, and if not carefully monitored it requires a hard restart. 0) Ensure you have no space in the path to Appcelerator Studio plugin folder 1) Import field services app from Studio sample pane 2) Set run configuration to use liveview 3) Open terminal and type "killall node" but do not hit enter (this will allow you to recover form error condition without restart) 4) Launch Matt's handy script to monitor processes (see related bug for script) 5) make an edit to the field service app (use App/my-service-outlets/myServiceOutlets.js) 6) When Matt's script shows more than 20 or so processes, move to the "killall node" terminal created earlier and hit enter. 7) Close and reopen the Studio editor for the myServiceOutlets.js file. If still populated, repeat.

Result:

The file is present but the contents are gone.

Expected Result:

Files remain unedited by the process

Attachments

FileDateSize
ps_grep_node_output_ipad_simulator_3.1.2.201305212422.txt_annotated.png2013-05-21T21:42:27.000+000057892

Comments

  1. Matt Langston 2013-05-14

    I can confirm I have seen this issue twice on FSA 1.0. A 0-byte file exists in place of the original file /Field-Service-App/app/controllers/my-service-outlets/myServiceOutlets.js
  2. Matt Langston 2013-05-14

    I have reproduced this using iPad Simulator. Live View truncated 49 files to 0-bytes: {noformat} field_service_app (1.0)$ git status | grep modified: | awk '{print $3}' | xargs ls -la -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/common/mapAnnotation.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/common/optionDialog.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/common/topNav.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/index.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/my-service-outlets/activeOutlet.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/my-service-outlets/myServiceOutlets.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/my-service-outlets/placard.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/confirmations.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/expenses.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/expensesDetail.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/itemHeader.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/productDetail.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/products.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/productsList.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/summary.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/taskDetail.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/taskRow.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/controllers/service-outlet-detail/tasks.js -rw-r--r-- 1 matt staff 0 May 14 13:12 app/lib/fieldServiceApi.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/lib/http.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/lib/salesforce.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/models/assignments.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/models/items.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/models/outlets.js -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/app.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/common/mapAnnotation.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/common/mapView.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/common/optionDialog.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/common/popover.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/common/topNav.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/index.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/my-service-outlets/activeOutlet.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/my-service-outlets/myServiceOutlets.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/my-service-outlets/placard.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/confirmations.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/detailsMenu.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/detailsView.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/documentDetail.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/documents.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/expenses.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/expensesDetail.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/itemHeader.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/productDetail.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/products.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/productsList.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/summary.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/taskDetail.tss -rw-r--r-- 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/taskRow.tss -rwxr-xr-x 1 matt staff 0 May 14 13:12 app/styles/service-outlet-detail/tasks.tss {noformat} Steps to reproduce: 1. Verify no files are 0-bytes in FSA 1.0 with this command: git status | grep modified: | awk '{print $3}' | xargs ls -la 2. Enable Live View for FSA 1.0 + iPad Simultor. 3. Edit line /Field-Service-App/app/lib/fieldServiceApi.js 4. Save file from within Studio. 5. Live View will trigger 70+ node processes. 6. Verify that 49 files were truncated to 0-bytes with this command: git status | grep modified: | awk '{print $3}' | xargs ls -la
  3. Matt Langston 2013-05-14

    I have confirmed that Live View can truncate several different types of source files, including .js, .tss and .xml files. An easy way to restore them from the FSA 1.0 branch is with this command: git status | grep modified: | awk '{print $3}' | xargs git checkout
  4. Matt Langston 2013-05-15

    I have confirmed that this bug is still present in Studio 3.1.1.201305141618 with Christian's latest Live View changes v0.1.20.
  5. Matt Langston 2013-05-17

    I have confirmed this bug is still present in Live View 0.1.21 in Studio 3.1.1.201305172432 (Date: 17 May 2013, 00:36:02). This time 55 files were deleted (see file list below). This bug is not ready for QE. {noformat} -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/common/mapAnnotation.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/common/mapView.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/common/optionDialog.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/common/popover.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/common/topNav.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/index.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/my-service-outlets/activeOutlet.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/my-service-outlets/myServiceOutlets.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/my-service-outlets/placard.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/confirmations.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/detailsMenu.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/detailsView.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/documentDetail.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/documents.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/expenses.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/expensesDetail.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/itemHeader.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/productDetail.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/products.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/productsList.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/summary.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/taskDetail.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/taskRow.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/controllers/service-outlet-detail/tasks.js -rw-r--r-- 1 matt staff 0 May 17 12:30 app/lib/fieldServiceApi.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/lib/http.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/lib/salesforce.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/models/assignments.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/models/items.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/models/outlets.js -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/app.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/common/mapAnnotation.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/common/mapView.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/common/optionDialog.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/common/popover.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/common/topNav.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/index.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/my-service-outlets/activeOutlet.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/my-service-outlets/myServiceOutlets.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/my-service-outlets/placard.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/confirmations.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/detailsMenu.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/detailsView.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/documentDetail.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/documents.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/expenses.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/expensesDetail.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/itemHeader.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/productDetail.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/products.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/productsList.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/summary.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/taskDetail.tss -rw-r--r-- 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/taskRow.tss -rwxr-xr-x 1 matt staff 0 May 17 12:30 app/styles/service-outlet-detail/tasks.tss {noformat}
  6. Ingo Muschenetz 2013-05-21

    [~mlangston] Can you see if you can reproduce this once you have _disabled_ the JMK beautification process?
  7. Tony Lukasavage 2013-05-21

    To disable it, simply rename or delete the "app/alloy.jmk" file.
  8. Matt Langston 2013-05-21

    I cannot reproduce the error when I "mv app/alloy.jmk app/alloy.jmk.save". However, this bug is so catastrophic (since it deletes most of the developer's source files under the app/ directory) that this bug should be fixed whether or not the user has an app/alloy.jmk file.
  9. Ingo Muschenetz 2013-05-21

    Yes, but whose responsibility is that to fix? The beautifier is purposely overwriting files. My feeling is that it should be responsible for not overwriting its own files. It's making an assumption that the code won't be called by multiple processes at the same time. That's a faulty assumption. If removing the JMK file fixes it, then I don't think it's our bug.
  10. Matt Langston 2013-05-21

    I agree that the root cause may indeed be in the beautifier. However, the fact remains that our software triggers this catastrophic bug, and it is not unreasonable that Alloy developers would want their code automatically beautified, since one of our own internal developers thought this was ok. I wouldn't want Appcelerator to get a black eye because of this. FYI I still don't know what a .jmk is and what beautification software is associated with it. All I know is that .jmk + Alloy + Live View deletes my source files.
  11. Tony Lukasavage 2013-05-21

    [~ingo] I would side with [~mlangston] on this one. The beautifier is doing nothing fundamentally wrong here. I don't think it's the best use of the alloy.jmk, but it is a totally valid one. And there are undoubtedly similar use cases that would be even more valid and useful that would run into the same issue. While the developer should take measures to ensure that they are safely performing file operations, I think it is a reasonable expectation that liveview will not be going crazy and launching the same process 100 times. I'm not even entirely certain if the developer is aware of this issue if they could even reasonably defend their code against it. And as Matt stated, this one is pretty catastrophic in terms of the damage that could be done, particularly since none of these issues would occur in the absence of liveview.
  12. Tony Lukasavage 2013-05-21

    [~mlangston] the alloy.jmk is simply a generic, optional container file that allows you to put pre and post compile hooks into the alloy process. They can be used for anything you want, and in this particular case, they are used to beautify the source files post compile. So there's nothing about alloy.jmk itself that is problematic, only what is actually be done in this case within it. It does shine a light on the fact that "touching" the source files during compile process though causes problems for liveview, which is a fairly common use case for the alloy.jmk when it is in fact used.
  13. Matt Langston 2013-05-21

    Than you Tony. FYI the source files are deleted serially (i.e. the file deletion bug isn't due to the node-party problem which Christian already fixed). The high-level solution to this problem is that a state machine should act as a governor for our workflow.
  14. Ingo Muschenetz 2013-05-21

    But what is the reasonable expectation? One node process? Two node processes? Is the fix that LiveView shouldn't be creating many node processes, or that Alloy shouldn't allow JMK file to run in parallel?
  15. Ingo Muschenetz 2013-05-21

    Matt, how are you getting that many node processes without a node party?
  16. Matt Langston 2013-05-21

    Ingo, I suggest you task someone with creating a simple state transition document or diagram for how our software interacts with each other and the user's files. If you think this is valuable I could do that after tomorrow.
  17. Tony Lukasavage 2013-05-21

    The reasonable expectation should be that liveview will launch a single instance of node per save. Though, given an adequately long enough compile time (exacerbated by the beautifier) that may not even be enough to stop it. I think at that point, the developer would be responsible for managing their own operations. Alloy couldn't really manage the jmk usage as they would all be contained in separate processes. I wonder too if this is specific to this particular beautification code, as it turns out it is not uglify-js and is instead jsbeautify, which I don't use.
  18. Ingo Muschenetz 2013-05-21

    My guess is that this is not a blocker for 3.1.1. Basically, "don't do this" right now.
  19. Matt Langston 2013-05-21

    Ingo, I don't know how the source files are being deleted without the node-party bug. I just measure that they are. Here is a plot of the number of node processes vs. time during which 49 source files were deleted from FSA 1.0 with app/Alloy.jmk file present. !ps_grep_node_output_ipad_simulator_3.1.2.201305212422.txt_annotated.png!
  20. Christian Sullivan 2013-06-19

    This should be resolved please re open if this is not true.
  21. Deepti Pandey 2014-04-22

    Verified as FIXED using : OSX: 10.9.2 Xcode:5.1.1 acs@1.0.14 alloy@1.3.1 npm@1.3.2 titanium@3.2.3-beta2 titanium-code-processor@1.1.1-beta1 MobileSDK :3.2.3.v20140418101718 Appcelerator Studio, build: 3.2.3.201404162038 LiveView Version: 1.0.4 File contents is available and no content loss has been noticed.Hence closing this ticket.

JSON Source