OokTech/TW5-Bob

http.server.listen() was called more than once

Closed this issue · 9 comments

Hi. I run it on nodejs on hosting. Clean tiddlywiki works, but when I run BobWiki wsserver I get http error 503 instead and this is stderr output:

/usr/local/lsws/fcgi-bin/lsnode.js:68
throw new Error("http.Server.listen() was called more than once " +
^

Error: http.Server.listen() was called more than once which is not allowed.
at Server.customListen [as listen] (/usr/local/lsws/fcgi-bin/lsnode.js:68:15)
at SimpleServer.listen ($:/plugins/OokTech/Bob/commands/wsserver.js:294:16)
at Command.execute ($:/plugins/OokTech/Bob/commands/wsserver.js:608:39)
at Commander.executeNextCommand ($:/core/modules/commander.js:107:14)
at Commander.execute ($:/core/modules/commander.js:64:7)
at Object.exports.startup ($:/core/modules/startup/commands.js:34:12)
at Object.$tw.boot.executeNextStartupTask ($:/boot/boot.js:2542:10)
at Object.$tw.boot.executeNextStartupTask ($:/boot/boot.js:2540:21)
at Object.$tw.boot.executeNextStartupTask ($:/boot/boot.js:2540:21)
at Object.$tw.boot.executeNextStartupTask ($:/boot/boot.js:2540:21)


I am running (check any that apply, put an x inside the [ ] to check a box, like this: [x]):

  • Windows
  • OSX
  • Linux
  • Other

and using

  • The nodejs version
  • The single file executable

Before posting I read issue guidelines and:

  • I am using the newest version
  • The answer to my question isn't listed in the documentation or this isn't
    a question
  • This is not a duplicate issue
  • I have not done anything that required me to set acceptance to
    I Will Not Get Tech Support For This

This is an error being thrown by litespeed (the error is thrown in lsnode.js here

It looks like that script modifies the http module in nodejs and changes the listen function to something completely different.

Since the error is from Litespeed not playing well with others I don't think there is anything I can do.

What are you doing to run both litespeed and bob in the same process?

I run this on node.js litespeed hosting from gui panel. I tried from ssh but don't know how to do reverse proxy config then or something that makes it accesible from domain adress (sorry for my noob skills).

I contact my hosting and ask them what to do.

They sent me only link for documentation:
https://www.phusionpassenger.com/library/indepth/nodejs/reverse_port_binding.html#caveat-multiple-http-server-objects-error-http-server-listen-was-called-more-than-once
and told that this is app fault. Honestly this isn't very important for me so if it's hard to solve I'm ok with it, maybe some day someone will get it working, also I'm up to test new patches/give more info. Maybe I contact tiddlyhost and ask them to add this extension? This would be more straightforward and useful as more people could use this extension then.

I like how they claim that a limitation of their service is a problem with the application.

The problem is that Bob can use multiple ports for different things, one for the normal wiki server and one for the saver server. Since you aren't going to need the saver server you may be able to fix the problem by editing settings.json in the root wiki and put set "enableBobSaver" to "no", then it would only try to use one port. There is some documentation about it here (https://github.com/OokTech/TW5-Bob/blob/master/Configuration.md), but if you need more help let me know.
If this does solve the problem I would like to write instructions on how to run bob on the hosting service, if this doesn't work than I don't think I will be able to without making a separate version of Bob just for that hosting service and I am not going to do that.

Thx, I tried and unfortunately doesn't work.

I did find another potential, although unlikely, reason. If the port for Bob (8080 by default) is used by something else Bob will try using a new port and continue until it finds an open port.
So setting the port to something different may work.
To try this change the port in settings.json under the 'ws-server' key.

I tried, doesn't work.

btw: What is recommended easiest way to run tw with your extension?

The easiest way to use it is to use BobEXE which is compiled into an executable. Just download the executable, put it into a folder where you want to have your wikis and open it. You can download BobEXE here https://github.com/OokTech/TW5-BobEXE/releases/tag/1.7.3

If you want to put it online so it is accessible I made some instructions for how to do that on digital ocean here https://gitlab.com/ooktech-tw/bobdocker/-/blob/main/README.md

Thanks!

I close this issue as it's probably not going to be resolved by litespeed or someone else. If bobwiki can be easily run on other service then it's probably better to just install it the recommended way.