fedwiki / wiki-server

Federated Wiki client and server in Node.js
Other
153 stars 35 forks source link

Do not listen on server start #79

Closed nrn closed 9 years ago

nrn commented 9 years ago

Worked with @WardCunningham to remove bouncy. Corresponding change in wiki-node.

WardCunningham commented 9 years ago

We've relieved this module of responsibility for listening for connections. It now has only to service connections that are handed to it. The effect is to limit the resources allocated to an occasionally used virtual site within a wiki farm.

The wiki command line now listens for all connections and hands them to a collection of express servers that it manages. See https://github.com/fedwiki/wiki-node/pull/23

WardCunningham commented 9 years ago

More discussion of server-side plugins in a farm environment. http://forage.ward.fed.wiki.org/server-side-plugins-listening.html

WardCunningham commented 9 years ago

Running through the test script I did get a server error which I doubt is related to this most recent refactoring but may be useful since it was run in a quiet and controlled environment on my laptop. The error occurred after finishing the Editor section and beginning the Drag section. http://ward.fed.wiki.org/things-to-test.html

The error forced the page to local storage. An immediate fork to origin succeeded. Here is what it looked like from the server log.

PUT /page/missing/action 200 2 - 12.528 ms
PUT /page/missing/action 200 2 - 10.152 ms
PUT /page/missing/action 200 2 - 11.297 ms
PUT /page/missing/action 200 2 - 5.023 ms
PUT /page/missing/action 200 2 - 11.903 ms
PUT /page/missing/action 200 2 - 10.239 ms
PUT /page/missing/action 200 2 - 2.632 ms
PUT /page/missing/action 200 2 - 3.471 ms
PUT /page/missing/action 200 2 - 10.457 ms
PUT /page/missing/action 200 2 - 10.467 ms
PUT /page/missing/action 200 2 - 5.361 ms
PUT /page/missing/action 200 2 - 4.033 ms
PUT /page/missing/action 200 2 - 11.460 ms
PUT /page/missing/action 200 2 - 9.876 ms
PUT /page/missing/action 200 2 - 3.297 ms
PUT /page/missing/action 500 - - 1.551 ms
[ 'Res sent:', 500, 'Ignoring move. Try reload.' ]
PUT /page/missing/action 200 2 - 14.484 ms

The error was caught and logged in the Journal entry for the move as follows.

image

This was easy to find with a text search from the log. However, the message doesn't seem to make it to the Journal. Fixing this alone would be a step forward for hunting down rare failures. https://github.com/fedwiki/wiki-node-server/blob/nrn/debounce/lib/server.coffee#L429

I may have destroyed evidence but when examining the page json in the flat file store I found the story ids were exactly as specified in the order attribute of the move action.

My own suspicion is that a rapid sequence of puts from the three-way splits have resulted in lost or mis-applied actions leading to an inconsistency between client and server that surfaces with the move. The server code in question could be made more fault tolerant but more important would be finding a robust way to deal with rapid edits outrunning the servers ability to apply them.

I will continue testing.

WardCunningham commented 9 years ago

I've completed my own test script. I ran the mocha tests which seemed to pass except for test/server.coffee.

image

This test appears to depend on the event signaling that has been modified. It would be good form to make this test pass before merging this code to master. @nrn can you have a go at this? Thanks.

nrn commented 9 years ago

Whoops, I think this should take care of that.

WardCunningham commented 9 years ago

I'm thinking this suite of pull requests are ready to be merged.

paul90 commented 9 years ago

Published as part of + wiki-server@0.4.0