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

crashes on save #963

Closed
bibodha opened this issue Mar 17, 2014 · 10 comments
Closed

crashes on save #963

bibodha opened this issue Mar 17, 2014 · 10 comments

Comments

@bibodha
Copy link

bibodha commented Mar 17, 2014

Karma v0.12.0
Browswer: Chrome 33.0.1750 (Windows 7)
Windows 7 running on VMWare on Mac OSX 10.9

Error Message:

ERROR [karma]: { [Error: ENOENT, stat 'c:\Projects\demo\test\appSpec.js']
  errno: 34,
  code: 'ENOENT',
path: 'c:\\Projects\\demo\\test\\appSpec.js' }
Error: ENOENT, stat 'c:\Projects\demo\test\appSpec.js'
INFO [watcher]: Changed file "c:/Projects/demo/test/appSpec.js".

This also happens when running PhantomJS instead of Chrome and happens very frequently.

@MaikuMori
Copy link

I also have this happening on Linux (Archlinux) using Karma 0.12.1:

INFO [watcher]: Changed file "/home/maiku/Projects/xxx/xxx/test/utils/xxx.js".
ERROR [karma]: { [Error: ENOENT, stat '/home/maiku/Projects/xxx/xxx/test/utils/xxx.js___jb_bak___']
  errno: 34,
  code: 'ENOENT',
  path: '/home/maiku/Projects/xxx/xxx/test/utils/xxx.js___jb_bak___' }
Error: ENOENT, stat '/home/maiku/Projects/xxx/xxx/test/utils/xxx.js___jb_bak___'

.js___jb_bak___ seems a bit strange, could be a file created by my IDE (PyCharm) when I save.

EDIT:
Just for completeness my include patterns are these:

{pattern: 'src/**/*.js', included: false},
{pattern: 'test/**/*Spec.js', included: false},

So it should not even include those temp files even if they're created on save and then deleted.

@bibodha
Copy link
Author

bibodha commented Mar 18, 2014

a workaround for this is running karma with auto-watch false and doing karma run. Kinda defeats the purpose but if you don't want it to crash on every save.

@dignifiedquire
Copy link
Member

This sounds like an issue with the respective editors in use. What are you using @bibodha?

@MaikuMori
Copy link

While it might be editor that is producing the bug, it's not the editors issue that karma fails. Karma in first place shouldn't match .js___jb_bak___ even if it's there.

My wild guess it's a race condition - karma gets notified that there is a change, it follows up with stat on the file, but the file is already deleted.

@MaikuMori
Copy link

Looks like the problem is here: https://github.com/karma-runner/karma/blob/master/lib/file_list.js#L305

The file is gone by the time stat is being called. I guess having SSD + Linux with it's filesystem caching magic improves the chance to get this error.

@bibodha
Copy link
Author

bibodha commented Mar 28, 2014

@dignifiedquire
My setup is as follows:

As mentioned previously: VMWare Fusion 6.0.2 on Mac OSX v10.9.2
Text Editor: GVim and Visual Studio 2013
Running on GitBash on Console2

Plugins: jasmine, require, coverage, phantomjs-launcher, chrome-launcher

@vojtajina
Copy link
Contributor

@MaikuMori can you put **/*.js___jb_bak___ into exclude config? That should work around the issue for now.

Can you guys also try setting usePolling: false?

Yep, this is a bug,

return fs.stat(path, function(err, stat) {
should ignore if there is an error.

Actually, when fixing this. We should not do the stat, if the stat is already provided by chokidar (when usePolling: true, chokidar already stats the file and gives us the stat, we should use it). See #469

@vojtajina vojtajina added this to the v0.14 milestone Mar 29, 2014
@DanTup
Copy link
Contributor

DanTup commented Apr 9, 2014

Possibly this is the same issue as #959? File gets renamed before Chokidar stats it; then the stat fails. PR #1020 should fix the crash; though whether it leaves any issues with changes not being detected, I'm not yet sure (haven't seen it; but if there are unhandled races between the editor and Chokidar, it might be a possibility)

@dignifiedquire
Copy link
Member

Is this still an issue?

@dignifiedquire dignifiedquire removed this from the v1.0 milestone Feb 19, 2016
@devoto13
Copy link
Collaborator

As we haven't heard any more reports of this problem in 4 years, I think it is pretty safe to assume that it was resolved. Happy to re-open if anybody still experiences the problem and can provide a reproduction.

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

No branches or pull requests

6 participants