Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation problems #93

Closed
o0Djeen0o opened this issue Feb 17, 2015 · 14 comments
Closed

Compilation problems #93

o0Djeen0o opened this issue Feb 17, 2015 · 14 comments

Comments

@o0Djeen0o
Copy link

Hi,
I've switched up from 0.57.0 to the 0.59.0 release.

  • Compilation became really slow, previously instantaneous on ctrl+s, now can easily take 20/30s first time and never end afterwards.
  • Even with a compilation of the project (ctrl+shift+b) the problem still occur.

Node seems to take much CPU resources in the meanwhile.

Could you help to investigate what is going wrong with the new version?

Thanks in advance for your help

@o0Djeen0o
Copy link
Author

After some restarts compile on save feature seems to be working again as intended, sorry for the inconvenience.

@basarat
Copy link
Member

basarat commented Feb 17, 2015

Two possible causes:

Invalid tsconfig file. Causes the worker to crash silently. Needs error reporting to user.

Chokidar file watching can perform bad sometimes (historically). No idea why though.

@o0Djeen0o
Copy link
Author

Hi,

Sadly the problem persists :

  • Even while just writing (no saving) the editor freeze
  • Constant high consumption of V8 in background
  • No compilation at saving time
  • Using the project compilation (ctrl+shift+b) doesn't really trigger new build.

I'm using an auto-created tsconfig.json file (created by the plugin) and tried each plugin up to 0.60 release. (now on atom 0.181).

It's really difficult to work on my project. I also tried to disable then enable the plugin again and it's seems to work afterwards. More a startup problem maybe?

Could I give you more information to help on the subject ?

{
    "compilerOptions": {
        "target": "es5",
        "module": "amd",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": true,
        "noLib": false
    },
    "filesGlob": [
        "./**/*.ts",
        "!node_modules/**/*.ts"
    ],
    "files": [
        "./definitions/bootstrap/bootstrap.d.ts",
        "./definitions/crossroads/crossroads.d.ts",
        "./definitions/hasher/hasher.d.ts",
        "./definitions/jasmine/jasmine.d.ts",
        "./definitions/jquery/jquery.d.ts",
        "./definitions/js-signals/js-signals.d.ts",
        "./definitions/knockout-projections/knockout-projections.d.ts",
        "./definitions/knockout/knockout-3.2.0.d.ts",
        "./definitions/knockout/knockout.d.ts",
        "./definitions/mousetrap/mousetrap-global-bind.d.ts",
        "./definitions/mousetrap/mousetrap.d.ts",
        "./definitions/sortable/sortable.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/lib.core.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/lib.core.es6.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/lib.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/lib.dom.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/lib.es6.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/lib.scriptHost.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/lib.webworker.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/typescript.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/typescriptServices.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/typescriptServices_internal.d.ts",
        "./node_modules/gulp-tsc/node_modules/typescript/bin/typescript_internal.d.ts",
        "./src/app/item.ts",
        "./src/app/router.ts",
        "./src/app/startup.ts",
        "./src/app/ui/ui.ts",
        "./src/components/base/comment/comment.ts",
        "./src/components/base/input-selector/input-selector.ts",
        "./src/components/base/input/input.ts",
        "./src/components/base/multivalue/multivalue.ts",
        "./src/components/base/select/select.ts",
        "./src/components/base/typeselection/typeselection.ts",
        "./src/components/base/value-selector/valueSelector.ts",
        "./src/components/comparators/interval-switch/parser.ts",
        "./src/components/comparators/interval-switch/switch.ts",
        "./src/components/comparators/numbers/numbers.ts",
        "./src/components/comparators/switch/switch.ts",
        "./src/components/empty-node/empty-node.ts",
        "./src/components/functions/flat/flat.ts",
        "./src/components/functions/free/free.ts",
        "./src/components/home-page/home.ts",
        "./src/components/nav-bar/nav-bar.ts",
        "./src/components/search/search.ts",
        "./src/logic/parameter.ts",
        "./src/logic/parameters.ts",
        "./src/references.d.ts",
        "./test/SpecRunner.browser.ts",
        "./test/SpecRunner.karma.ts",
        "./test/components/home-page.ts"
    ]
}

@o0Djeen0o o0Djeen0o reopened this Feb 19, 2015
@basarat
Copy link
Member

basarat commented Feb 19, 2015

@o0Djeen0o thanks for raising this. To help us narrow out the possible causes can you completely disable chokidar. I.e. comment out the entire body of watchProjectFile so that we have:

function watchProjectFile(projectFile: tsconfig.TypeScriptProjectFileDetails) {
    /*if (watchingProjectFile[projectFile.projectFilePath]) return; // Only watch once

    var watcher = chokidar.watch(projectFile.projectFilePath, { ignoreInitial: true, persistent: true });
    watchingProjectFile[projectFile.projectFilePath] = watcher;

    function clear(datPathYo) {
        // TODO : Invalidate only matching caches for projectFilePath
        // Right now: Just invalidate *all*
        projectByProjectPath = {};
        projectByFilePath = {};
    }

    watcher.on('change', clear)
        .on('unlink', clear);*/
}

and see if it fixes it.

basarat added a commit that referenced this issue Feb 20, 2015
@basarat
Copy link
Member

basarat commented Feb 20, 2015

see if v0.63.0 fixes it. I suspect it will as it has a much more stable node worker ❤️

@o0Djeen0o
Copy link
Author

Thank you for your response.

I've tried the 0.63.0 release but it appears that problem still occurs.

Then I've tried your suggestion and completely disabled chokidar integration. For now my problem seems not reproducible, so it appears that your assumption is correct. I will update my answer if things went wrong again.

@basarat basarat self-assigned this Feb 20, 2015
@basarat
Copy link
Member

basarat commented Feb 22, 2015

note to self: if it really does boil down to chokidar we could just reload hard refresh tsconfig cache from disk on save.

@csnover
Copy link
Member

csnover commented Feb 22, 2015

I see some stack traces pointing to atom-typescript via chokidar when saving files that are not TypeScript files and not in projects that should be touched by atom-typescript. From the stack trace it looks like it’s hooked itself into several of the fs methods, so any time atom-typescript is active and a filesystem error occurs, it’s going to get reported as being the fault of atom-typescript. (In my case, atom/atom#4467 is the real bug.) Seems like this is probably not…desirable.

@basarat
Copy link
Member

basarat commented Feb 22, 2015

Alright I've moved this to the top of my queue. Will remove the chokidar dependency and make sure not to break this #83

basarat added a commit that referenced this issue Feb 23, 2015
@basarat
Copy link
Member

basarat commented Feb 23, 2015

pushed in v0.67.0. @o0Djeen0o please comment / reopen if you still have issues

@ciuncan
Copy link

ciuncan commented Aug 20, 2015

hi @basarat, I think this issue persists with 5.4.2.

This plugin was working brilliantly until I tried adding gulp build workflow. It started showing thousands of error and still counting up, also blocks and fills some process queue (either atom's or atom-typescript's, not sure). Errors are about duplicate definitions shown at the lib.d.ts etc. files in node_modules/gulp-tsc/, which I guess contains an typescript module dependecny in it.

Here is my tsconfig.json:

{
    "compilerOptions": {
        "removeComments": false,
        "sourceMap": true,
        "target": "es5",
        "module": "commonjs",
        "outDir": "app/dist/js"
    },
    "fileGlob": "app/src/**/*.ts"
}

and package.json:

{
  "version": "0.0.0",
  "description": "",
  "main": "Gulpfile.js",
  "dependencies": {},
  "devDependencies": {
    "gulp": "^3.9.0",
    "gulp-plumber": "^1.0.1",
    "gulp-sass": "^2.0.4",
    "gulp-tsc": "^1.1.0",
    "gulp-uglify": "^1.2.0"
  }
}

Am I doing something wrong? Is there a recommended way to have typescript compilation in gulp build process?

@basarat
Copy link
Member

basarat commented Aug 20, 2015

@ciuncan if yo can provide the repo I'd be happy to debug it deeply. Also feel free to create a new issue specific to you problem 🌹

@ciuncan
Copy link

ciuncan commented Aug 20, 2015

@basarat Thank you for your concern. This is a bit embarrassing but tried re-adding "gulp-tsc" back (prior to that, I have switched backed to atom-typescript compilation via tsconfig.json) but I couldn't reproduce the problem. So good news is it now works fine. I did a clean atom reinstall including $HOME/.atom maybe it did the trick.

If such a thing occurs again, I'd be coming back with concrete examples so it could be debugged.

Thanks again.

@basarat
Copy link
Member

basarat commented Aug 20, 2015

no worries 🌹

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants