Bringing down server #16

Closed
wlaurance opened this Issue Jul 8, 2012 · 6 comments

2 participants

@wlaurance

Hey,

When I push to my blog_repo, my glog server craps out. I never have had this problem before.


Updating blog git repo
Stdout: Updating 530efd2..491dd6f
Fast-forward
 layout.jade     |    5 ++---
 public/main.css |   12 +++---------
 2 files changed, 5 insertions(+), 12 deletions(-)

Stderr: From github.com:wlaurance/fuzzy-octo-adventure
 * branch            master     -> FETCH_HEAD

Loading articles from blog_repo/articles
Reading file 05-24-12intro.txt
Reading file 05-25-12coffeescript.md
Reading file 6-1-2012billable.md
Read articles with headers: 
{ title: 'Introduction', date: '5/24/2012', author: 'wlaurance' }
Read articles with headers: 
{ title: 'What I love about CoffeeScript', date: '5/25/2012' }
Read articles with headers: 
{ title: 'Billable', date: '6-1-2012' }
preplugins
Searching this article, Introduction
Searching this article, What I love about CoffeeScript
Searching this article, Billable
Ditaa tags found in Billable
Compiling template for home page
Compiling template for individual pages
Starting server on port 8080

events.js:48
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: listen EADDRINUSE
    at errnoException (net.js:670:11)
    at Array.0 (net.js:771:26)
    at EventEmitter._tickCallback (node.js:190:38)
@wlaurance

I am at 8fcd40c

@wlaurance

From what I can tell, the only way this line of code "Starting server on port 8080" prints is if node server.js is run again.

@wlaurance wlaurance added a commit to wlaurance/Glog that referenced this issue Jul 9, 2012
@wlaurance wlaurance See #16
Fixes plugin function array accumulation.
6c352b9
@guyht
Owner
@wlaurance

So when the server fired up the plugin array looks like this

1cb: wcb
Ncb: N callbacks for plugins
N+1: the original cb given to render_articles

On __render
1cb: wcb
Ncb: N callbacks for plugins
N+1: the original cb given to render_articles
2Ncb:N more callbacks for plugins
2N+1: the new cb for update articles.

So the N+1 callback was the original callback when starting the server, thus it indeed attempts to listen on the same port and throws the addr in use error.

@guyht
Owner

Have merged #17. Going to to a proper regression test of it tonight and prepare a new release

@wlaurance

Closing this issue

@wlaurance wlaurance closed this Oct 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment