Closed jcpetkovich closed 11 years ago
I can't reproduce this problem. I don't get any completions on express.
, but everything else still works. The list of http connection processes (which should be cleaned up as soon as they complete) suggests something is going wrong. Do you have a node
process eating up 100% cpu? What happens when (first killing all existing servers) run the Tern server manually from the same dir as your .tern-project
, passing it the --verbose
flag and looking at its output?
The node process is not eating up cpu, just sitting at 0-1%.
Log obtained by running tern on its own as instructed, and using steps 1-7 can be found here: http://pastebin.com/RfQBKaYk
Please let me know if there is anything else I can do to help. I'll see if I can coax out an answer in the meantime.
There's data for one completion and then one type query (for fetching argument hints as you were typing require(
, I guess) which completed normally. No requests are logged after that. So your next actions either didn't cause any requests, or the requests somehow got lost before they were logged. Looking at the server code, the request JSON is logged before the analysis engine is involved, and thus before most likely causes of hangs come into play.
This might point at the emacs mode as getting into a messed up state somehow. But how the presense of require("express")
could influence the editor side I can't imagine. Does anything interesting show up in your *Messages*
buffer?
Here is a pastebin for Messages using steps 1-7 again (tern run manually). http://pastebin.com/xRDDqdz1
I've never seen the message about let-bound
but it doesn't look like it's likely to be the problem. The rest of the message log looks completely harmless.
Not sure whether this is relevant, but I recall a case of tern hanging because its continuation-style response loop wasn't completed properly (https://github.com/marijnh/tern/commit/83a36ea029dff7b9572470a115abfa66532f84ee). And I did see missing log output once (on windows), which could be worked around by switching log output to stderr [take this last part as a rumour, but perhaps it helps;-)].
The request json is logged before the response loop is entered, so, judging from the --verbose
log, that's unlikely to be happening here.
I don't think express has much to do with this issue anymore. I've actually managed to reproduce the same behaviour without using express, and just adding a line like the following instead:
var content = fs.readFileSync("whatever.txt");
After swapping out the logging functions to use util.debug
instead (since it is synchronous, and console.log
is not), I'm getting a lot more requests in general, but very few responses from the server. I also notice that after the first completion, on fs
in the var content line, any subsequent line results in no completions. Things like variable lookup with M-.
still seem to work occasionally after that, or at least send out requests that don't get responses. The only thing that seems to stop sending out requests (sometimes) is completion.
I've also tested for the presence of the issue in non-distro-packaged versions of emacs and node. I got the official tarballs from both and compiled them on my two machines. Both machines exhibited the issue with both the distro packaged versions (with patches) and the non-distro-packaged versions (without patches).
I've tried running tern's own tests, and all of them pass (if that's of any help). I might have more time this weekend to poke around a little more and see what's happening.
I checked out a newer version of tern and found that it was working fine.
I tracked down the commit that fixed it using git bisect: 77278da
Great! Thanks for tracking that down.
I've run into some issues when playing around with
tern
.tern
works great in its own project directory. It's really quite awesome. But when I try it out in a project that pulls in other libraries fromnpm
likeexpress
I run into trouble.Specifically the completion, documentation, and definition finding functions stop working and supply no error messages. The only thing I've noticed that's odd is the buildup of processes as observed through using 'list-processes:
127.0.0.1 open http 127.0... -- (network connection to 127.0.0.1) 127.0.0.1<1> open http 127.0... -- (network connection to 127.0.0.1) 127.0.0.1<2> open http 127.0... -- (network connection to 127.0.0.1) 127.0.0.1<3> open http 127.0... -- (network connection to 127.0.0.1)
Admittedly I'm probably doing something wrong. Here are the steps and lib versions I'm using to reproduce this issue, maybe someone can tell me what I'm doing wrong.
Libraries used:
GNU Emacs 24.3.1 tern 0.1.0 node 0.10.5 express 3.1.0
Reproducible on my machine with the following steps:
Start emacs:
Run the following elisp:
Open up a test.js in this simple node project with the following files:
Run:
Add to test.js: