claudioc / jingo

Node.js based Wiki
MIT License
1.02k stars 184 forks source link

Process exits after accessing unknown page history #39

Closed heptal closed 10 years ago

heptal commented 10 years ago

Sometimes I notice that my process has died, even when I don't recall explicitly having accessed unknown pages. Logs say the history of an unknown page was requested. I suppose it could happen if a web crawler tries to reindex a previously present page.

To reproduce: Assuming wiki.myhost.com is jingo, go to http://wiki.myhost.com/wiki/some_made_up_page/history

Instead of a 404, the process will exit with the error:

/app/node_modules/jingo/lib/tools.js:14
    var title = content.split("\n")[0];
                        ^
TypeError: Cannot call method 'split' of undefined
    at Object.tools.getPageTitle (/app/node_modules/jingo/lib/tools.js:14:25)
    at /app/node_modules/jingo/routes/index.js:428:36
    at /app/node_modules/jingo/lib/gitmech.js:215:9
    at ChildProcess.<anonymous> (/app/node_modules/jingo/lib/gitmech.js:36:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

This does not happen with normal unknown page access, which redirects to a 404.

The pageHistory function in routes/index.js does check for error in the same as pageShow and tries to redirect to /, so it's not clear to me what is happening here.

claudioc commented 10 years ago

Hi,

sometimes I noticed this problem on my server too. I don't understand very well how to reproduce it, but the fix is easy. I am working hard on Jingo 1.0 (which is an almost complete rewrite) which should address all of this problems by the use of clusters.

I will keep this open to try to make it happen on 1.0 (which will be released in a week or two).

Thank you very much for your time!