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

Ubuntu 11.10 server side restart not working #82

Closed
davisford opened this issue Apr 12, 2012 · 17 comments
Closed

Ubuntu 11.10 server side restart not working #82

davisford opened this issue Apr 12, 2012 · 17 comments

Comments

@davisford
Copy link

  • node v0.6.14
  • nodemon 0.6.14
uname -a
Linux kafka 3.0.0-15-generic #26-Ubuntu SMP Fri Jan 20 17:23:00 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Server side changes are not restarted by nodemon. I saw this: #79, but this is a normal linux install, not on a read-only filesystem.

Same code base checked out on Mac OS X started with: nodemon app.js => edit app.js => save => nodemon restarts app.js

On Ubuntu 11.10, nodemon does not restart app.js

Any ideas?

@davisford
Copy link
Author

i guess this is a dupe of #66 -- i'm also using socketstream. fix was mentioned to drop down to 0.5.7 nodemon. note remy said fix would be pushed to 0.6.10, but problem still exists for me in 0.6.14

@ayoung
Copy link

ayoung commented Apr 13, 2012

I can duplicate this issue as well. Similar environment. Ubuntu 11.10. nodemon 0.6.14

@bramp
Copy link

bramp commented Apr 14, 2012

I'm having the same issue on Debian linux. I tracked this down to nodemon executing the following command:
find -L "/home/bramp/src/flickr-timemachine" -type f -mtime -1s -print
which results in this error:
find: invalid argument -print' to -mtime'

I fixed this, by just changing
noWatch = !fs.watch,
at the very top of nodemon, and now it's using native fs.watch, instead of polling find.

Perhaps fs.watch vs polling vs whatever, should be a config option?

@justinschier
Copy link

I'm also having this issue on Ubuntu 11.10. Seemed like it was working until I upgraded to Node 0.6.15.

uname -a
Linux xxxxx.xxxxx.com 3.0.0-17-server #30-Ubuntu SMP Thu Mar 8 22:15:30 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

@davisford
Copy link
Author

@bramp thanks for tracking the issue down; i did revert my nodemon to 0.5.7 and that fixes the problem on ubuntu, so either apply @bramp 's fix or revert to an older version.

dylanmcd added a commit to dylanmcd/nodemon that referenced this issue Apr 20, 2012
remy added a commit that referenced this issue Apr 23, 2012
Fix for #82, while maintaining compatibility with #72. Uses fs.watch as a fallback.
@panosru
Copy link

panosru commented Apr 29, 2012

I still have this issue with Debian 6 64bit...

root@dev:~# node -v
v0.6.15
root@dev:~# npm -v
1.1.18
root@dev:~# uname -a
Linux dev.panosru.me 2.6.32-5-amd64 #1 SMP Mon Jan 9 20:49:59 UTC 2012 x86_64 GNU/Linux

@dylanmcd
Copy link
Contributor

@panosru Can you help troubleshoot this?

I'll give a brief rundown of how Nodemon looks for changes (in 0.6.18)

By default, unless on windows, nodemon will use the "find" command. The find command relies on being able to search for files modified within x seconds, which not all versions of find do. In particular, recent Debian flavors don't seem to support this feature. When nodemon starts, it tries to detect whether your version of find supports this feature.

The other behavior is to use fs.watch. fs.watch behaves differently on different systems - http://nodejs.org/api/fs.html#fs_caveats and that may be where you are running into trouble.

To figure out where the problem is coming from, you'll want to put tracers in the startMonitor() function. First figure out what version of changeFunction is being used (depends on what noWatch is set to), then try tracing the potential errors and exceptions. There are several potential errors that are silently ignored.

The other thing that could go wrong is the detection code at ~line 33. That's where the program decides if the "find" method will work. You can try setting noWatch explicitly to true or false after that and see if that makes a difference.

@panosru
Copy link

panosru commented Apr 29, 2012

So far I got these debug info:

  1. noWatch is set to true, I tried to set it to false but it still didn't restart.

  2. while noWatch is on true i tries to run this command find -L /dev/null -type f -mtime -1s -print but I'm getting this error:

{ [Error: Command failed: find: invalid argument `-print' to `-mtime'
] killed: false, code: 1, signal: null }

then it checks for fs.watch and it exists so it sets noWatch to false and continues process

Then I checked changeFunction and it seems to recognize all the files of the project, all try {} catch (e) {} blocks don't have any error, everything seems to be recognized normally, dirs, files, stats of files etc

I use this command to run nodemon here: NODE_ENV=development nodemon -w apps/api/ bootstrap.api.js and I have .nodemonignore file on root where bootstrap.api.js is which contains this:

generated/
views/**.jade
node_modules
public/**
.DS_Store
translation.json
tmp/**

EDIT:
I tried with cmds.push('find -L "' + dir + '" -type f -mmin -1'); but it didn't worked too... :/

@dylanmcd
Copy link
Contributor

@panosru
Thanks for doing some debugging, everything is as it should be (including the error).

I installed Debian 6 to see if I could reproduce and was unable to. However, the way you are running node, it would only respond to files changes that are within the app/api/directory. So if you are editing bootstrap.api.js, nodemon will not reload (by design). -w instructs nodemon to ONLY watch files within that folder (and that folders subdirectories).

So just to clarify, nodemon won't reload even when you edit stuff within apps/api/ ? Can you try a test of running nodemon just like nodemon app.js and changing app.js to see if you can get a reload?

@panosru
Copy link

panosru commented Apr 29, 2012

@dylanmcd thanks a lot for your help, the files I'm editing are under app/api/ I tried to run # nodemon bootstrap.api.js and edit that file but still nodemon wont restart... Also one thing I forgot to mention is that the folder where bootstrap.api.js is located is on my OSX machine as I have Debian 6 install on VMWare and use it for my local development server, nodemon is installed in debian 6 and I use fstab in order to mount the paths I need via NFS but it used to work normally...

@dylanmcd
Copy link
Contributor

@panosru

I think if you want to pursue it at this point you may need to track down at which version nodemon stopped working for that use case, and diff with the version that stops working to see what changed. nodemon is small and just a single file, so the difference should jump out at you. If I could reproduce it, I'd be happy to help, but it works on Debian 6 for me (w/o the mounting to OSX stuff of course). Good luck!

@panosru
Copy link

panosru commented Apr 30, 2012

@dylanmcd thank you for all your help so far! :) I found out that v 0.6.7 is the latest version that works fine for me, what do you suggest me? make a diff of nodemon.js file for each version after 0.6.7?

I'll do a diff with latest version of nodemon since there is no point of doing a diff for each version after 0.6.7 :)

@dylanmcd
Copy link
Contributor

@panosru

I diffed 0.6.7 with 0.6.8 and the major change is that 0.6.8 starts using fs.watch to detect changes instead of a custom method. fs.watch is more perfomant, but apparently you've got a use case where it doesn't work (somewhat documented in http://nodejs.org/api/fs.html#fs_caveats ).

The problem is, fs.watch seems to fail silently. If we can figure out how to detect whether fs.watch will work or not, we can reintegrate the original method as a fall back. One way might be to create a file in /tmp, make a change to it, and see if it triggers fs.watch. That could get a bit messy though. I'll think on it.

@dylanmcd
Copy link
Contributor

@panosru

Since this is a separate issue from the Ubuntu 11.10 issue, I've opened up a new one that explains the problem.

@panosru
Copy link

panosru commented May 3, 2012

@dylanmcd ok! Thanks :) for now I use nodemon@0.6.7 to speed up my development because I'm a bit busy but once I'll get some time I'll try to debug it deeper :)

@dylanmcd
Copy link
Contributor

dylanmcd commented Jun 6, 2012

Both issues should be closed now, at least in the current repo.

@panosru
Copy link

panosru commented Jun 6, 2012

@dylanmcd I close this issue but I commented on the #93 because there is another issue now which makes nodemon -L restart all the time without editing any file...

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

No branches or pull requests

7 participants