Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

[File watchers] Spurious 'File has been modified on disk' warnings on save #6437

Closed
peterflynn opened this issue Jan 9, 2014 · 49 comments · Fixed by #6949
Closed

[File watchers] Spurious 'File has been modified on disk' warnings on save #6437

peterflynn opened this issue Jan 9, 2014 · 49 comments · Fixed by #6949
Assignees
Milestone

Comments

@peterflynn
Copy link
Member

Several team members have reported seeing this warning upon save:
ext-changes-example

...in cases where they were pretty sure nothing had actually modified the file. (Even if something did modify the file, it'd be fairly rare to see this dialog because watchers would spot the change first -- so it's worrisome to be seeing it so often).

If anyone sees this, please look in the console for warning messages of the form:
"Blind write attempted." We'd really like to see what's getting logged there.

@ghost ghost assigned iwehrman Jan 9, 2014
@peterflynn
Copy link
Member Author

We're pretty sure the filesystem is recording the right timestamp after saving -- if that wasn't reliable, users would have already been seeing erroneous conflict messages when re-focusing the Brackets window in past sprints. But it's unclear what else could be making File._hash mismatch what's on disk -- unlike caches, _hash is never thrown away, only updated with newer values...

@jasonsanjose
Copy link
Member

I just hit it with the brackets project open, editing and saving in my normal workflow on my mac, synced to master:

Blind write attempted:  /Users/jasonsj/Github/brackets/src/project/ProjectManager.js 1389304968000 1389304942000 

@iwehrman
Copy link
Contributor

iwehrman commented Jan 9, 2014

The first date there is 14:02:48 and the second is 14:02:22, which is interesting because:

  1. Both dates are non-null;
  2. The dates are fully 26 seconds apart;
  3. The former, actual hash is greater than the latter, expected hash.

@njx
Copy link

njx commented Jan 9, 2014

Is it possible that different processes could somehow have inconsistent timestamps when they write files? I can't imagine how that would happen on a single machine...

@iwehrman
Copy link
Contributor

iwehrman commented Jan 9, 2014

There's only one process performing I/O.

@iwehrman
Copy link
Contributor

It would also be helpful to run this command in the background to help with debugging:
sudo fs_usage -f filesys | grep ".js" > modtimes.out
Over time this will generate quite a lot of data about what processes are modifying .js files on your disk. With any luck, the contents of modtimes.out will help us identify what external process is changing the mtimes of files on disk.

@jasonsanjose
Copy link
Member

@iwehrman should we marked this FBNC after #6473 was merged last week?

@iwehrman
Copy link
Contributor

We can mark it FBNC or fix-in-progress, but we should probably leave it open as a place to track the still-present problem.

@njx
Copy link

njx commented Jan 13, 2014

If I'm understanding #6473 correctly, it seems like the symptom that this bug describes will no longer occur, but a different user-visible bug will occur (if the file is modified when the external process touches the file, you'll see the other "externally modified file" dialog). Would it make sense to close this and then open a new bug describing the other behavior?

Also, would this other bug prevent us from shipping the feature? It seems like it shouldn't if it's not common, but it sounds like we don't actually know what's touching the files, and it could be something that we're not thinking of that lots of people might have.

@njx
Copy link

njx commented Jan 13, 2014

Sounds like what we should do is keep this open (or open a new bug for the other issue and close this one), and have a few people run the debug command that @iwehrman suggested to try to figure out what's touching the files.

@pthiess
Copy link
Contributor

pthiess commented Jan 13, 2014

@njx added this one to the parking lot.

@ghost ghost assigned peterflynn and jasonsanjose Jan 13, 2014
@iwehrman
Copy link
Contributor

Re-assigning to @jasonsanjose, since he and @peterflynn and probably the right people to track this.

@jasonsanjose
Copy link
Member

@iwehrman @peterflynn I just got it to happen again on mac and had the logging running, see https://gist.github.com/jasonsanjose/8423970.

Also here's my console log:

Blind write attempted:  /Users/jasonsj/Github/brackets/src/project/ProjectManager.js 1389726548000 1389726522000 

@jasonsanjose
Copy link
Member

@dangoor are you running mcafee with "on access" scanning enabled?

@iwehrman
Copy link
Contributor

I haven't seen this bug myself yet, but I have the "on access" scan permanently disabled, and it seems likely that both @jasonsanjose and @dangoor are running with it enabled. There isn't a smoking gun in the log that points to the VShieldScanner though; it opens and accesses the afflicted file regularly, but the log shows only Brackets as writing the file. Still, I am suspicious...

@dangoor
Copy link
Contributor

dangoor commented Jan 14, 2014

Yeah, "on access" scanning is enabled. That does sound a bit ridiculous.

I do so a lot of "buffer overruns" in the console with fs_usage running.

@pthiess
Copy link
Contributor

pthiess commented Jan 16, 2014

@peterflynn Is this still a high priority?

@peterflynn
Copy link
Member Author

No, not for the remaining part. Bumping down to a medium.

@dangoor
Copy link
Contributor

dangoor commented Jan 21, 2014

I just saw this again. Other processes that were accessing the file were VShieldScanM, VShieldScann, CrashPlan (appears as java), mdworker, mds, fseventsd, dbfseventsd. I have posted the log for the few minutes preceding the dialog.

I have seen this message roughly 3 times in the past day.

@njx
Copy link

njx commented Jan 23, 2014

I also just hit this on my Mac. Console shows Blind write attempted: /Users/nj/github/njx.github.io/index.html 1390444370000 1390444352000. Unfortunately I wasn't running the logger.

I do have VirusScan running with on-access scanning enabled, fwiw.

@njx
Copy link

njx commented Jan 23, 2014

Also, the thing I had just done before this happened was to (in Finder) copy several new versions of CSS files (for the framework I was using, Foundation) into a subfolder of my project, and then switch back into Brackets and make edits to a different file, then try to save it.

@njx
Copy link

njx commented Jan 28, 2014

Just hit this again today. I was just editing a markdown file, hadn't done anything special. Unfortunately I wasn't running the file write monitor logging...I'll turn it on again now and see if I hit it again.

@njx
Copy link

njx commented Jan 30, 2014

Argh, ran into this again but since I had been switching branches I didn't have the extra logging patch at the time...

@iwehrman
Copy link
Contributor

Has anyone come up with a hypothesis other than VShieldScan or CrashPlan? Not that there is any concrete evidence for those hypotheses; just that I have always had the on-access McAfee scanning disabled on my machine and didn't see this for months. Maybe try going through the hoops with IT to disable that scanning and see if it happens again? If so, at least we could cross that off our list of possible culprits.

@njx
Copy link

njx commented Feb 1, 2014

Finally ran into this with @peterflynn's logging statements turned on. The log is at https://gist.github.com/njx/8746299 - the file involved is the one mentioned at the end, EditorCommandHandlers-test.js. Note that I was on the cmv4 branch at the time, but I'm assuming that shouldn't affect anything.

@njx
Copy link

njx commented Feb 4, 2014

Ran into it again with the extra logging enabled. Unfortunately, it doesn't give us any more clues - there's no extra file change notification on either the node or Brackets side between the last write and the blind write. (Note that the log is a bit confusing because I was editing both EditorCommandHandlers.js and EditorCommandHandlers-test.js - the blind write was in the latter.)

https://gist.github.com/njx/8813504

@jasonsanjose jasonsanjose assigned njx and unassigned jasonsanjose Feb 5, 2014
@jasonsanjose
Copy link
Member

Changed assigned from @jasonsanjose to @njx.

@bchintx
Copy link
Contributor

bchintx commented Feb 5, 2014

Confirmed @njx's temporary workaround as Pull Request #6745 for the Sprint 36 release. Will leave this issue open to continue tracking this problem though.

@njx
Copy link

njx commented Feb 10, 2014

We just got a report in #6819 of a slightly different problem occurring on Win, but it seems like the same kind of thing (mysterious external change coming in without the file having actually changed as far as the filer knows).

We had talked about putting in a workaround where, before warning the user of a conflict, we do a content check on the file to see if it's actually changed from the previous cached version. It seems like we should go ahead and make sure to do that for 37. @peterflynn - what do you think?

@njx
Copy link

njx commented Feb 15, 2014

I've gotten this to happen with both @peterflynn's in-Brackets logging and the file event logging on. Unfortunately, I don't think it tells us anything.

Brackets log: https://gist.github.com/njx/9013676
File event log (grepped to only show the relevant file): https://gist.github.com/njx/9013687

The blind write attempt expected the time 18:16:26 but got 18:16:54. There's nothing in the file event log for 18:16:54 - there are some accesses at 18:16:53 from Java (probably my CrashPlan process) but they're just getAttrList/stat calls.

@njx
Copy link

njx commented Feb 15, 2014

One thing I should do next time I run into this is verify that the timestamp as shown by ls matches the modtime we're getting. I think I did that once before but am not sure.

@JeffryBooher
Copy link
Contributor

FBNC @peterflynn

@peterflynn
Copy link
Member Author

Removing FBNC until the fix is actually merged

@JeffryBooher
Copy link
Contributor

FBNC @peterflynn merged into master now

@njx
Copy link

njx commented Feb 22, 2014

I'll test this since I was running into the bug frequently.

@njx
Copy link

njx commented Feb 25, 2014

I've been using this for a couple of days now, and while I haven't been editing as heavily as I was before, I have been saving files, and haven't seen the dialog. So I'm going to close this as fixed for now - if I see it again I'll reopen.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants