Skip to content

tsc incremental compilation rewrites all files on docker (for windows) volume #13242

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

Closed
wclr opened this issue Jan 1, 2017 · 4 comments
Closed
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@wclr
Copy link

wclr commented Jan 1, 2017

TypeScript Version: nightly (2.2.0-dev.201xxxxx)

tsc incremental compilation rewrites all compiled files on docker volume (docker for windows)

To reproduce it:

  • install docker for windows or try with your instlaled docker
  • create dir and make npm init
  • npm install typescript@next
  • create two files 1.ts and 2.ts with some code.
  • run tsc in docker docker run --rm -v FULL_PATH_TO_YOUR_DIR:/app -w /app mhart/alpine-node:7.1.0 ./node_modules/.bin/tsc -w
  • see that tsc created both files 1.js and 2.js
  • wait some minute then change the code of only 1.ts
  • tsc will recompile
  • see the date for 1.js and 2.js, you will see that 2.js too has been rewritten, though it should not be the case (it is not the case if you run tsc without docker windows)

This happens due to this check:
https://github.com/Microsoft/TypeScript/blob/e4b81d03311ae157486dd2ebbd7d381996066174/src/compiler/program.ts#L148

and that ts.getModifiedTime returns strange result, probably this is not a typescript issue, but docker/node, but an issue for typescript users.

Btw what is a reason to check time modified, isn't the hash is just enough?

Windows 10, docker for windows 1.12.5 (this the same case should be for docker for mac)

@wclr wclr changed the title tsc incremental compilation rewrites all files on docker for windows volume tsc incremental compilation rewrites all files on docker (for windows) volume Jan 1, 2017
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@jngbng
Copy link

jngbng commented Dec 27, 2017

It also happens on Docker for mac and makes the docker keep consuming lots of cpu resources.

@jngbng
Copy link

jngbng commented Dec 27, 2017

I found the reason why the cpu is pegged at 100% from here:
https://forums.docker.com/t/docker-compose-volumes-gulp-watch-100-cpu-usage/10192/7

TSC uses fs.watchFile as well and suffers the same problem: https://github.com/Microsoft/TypeScript/blob/e4b81d03311ae157486dd2ebbd7d381996066174/src/compiler/sys.ts#L464

@mhegazy
Copy link
Contributor

mhegazy commented Jan 10, 2018

@sheetalkamat is there anything we can do here?

@sheetalkamat
Copy link
Member

@mhegazy this seems like same as #19762 and i am in final stages of prototyping few different behaviors for watching files/directories to get feedback and we can make decision afterwards

@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

5 participants