Everytime A diplomat is played, my game crashes.

You can get help here if Freeciv doesn't start on your computer, or if you keep getting fatal errors while playing etc.
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Everytime A diplomat is played, my game crashes.

Post by sveinung »

AndreasR wrote:Great sveinung! clearly marked untested pull requests would be great.
In that case I'll do that until I'm able to test it my self.
AndreasR wrote:I would be glad to help you solve any problems you might have with setting up Vagrant.
I think I'll have to do a bare metal install. I'm currently on an old, borrowed, laptop. Last year Vagrant + freeciv-web always caused it to overheat and power off before I could test anything. I did manage to run freeciv-web on its bare metal without this problem.

I've currently gotten to a point were my web browser complains that "WebSocket connection to 'ws://localhost/civsocket' failed: Error during WebSocket handshake: Unexpected response code: 404" while http://localhost:7002/status says "Process status: OK". Any suggestion about what log or config file I should look at?
cazfi
Elite
Posts: 3107
Joined: Tue Jan 29, 2013 6:54 pm

Re: Everytime A diplomat is played, my game crashes.

Post by cazfi »

sveinung wrote:I've currently gotten to a point were my web browser complains that "WebSocket connection to 'ws://localhost/civsocket' failed: Error during WebSocket handshake: Unexpected response code: 404" while http://localhost:7002/status says "Process status: OK". Any suggestion about what log or config file I should look at?
On my bare metal install I've got to change "PROXY_PORT = 7002" in freeciv-proxy/freeciv-proxy.py, and freeciv server runs at port 6002 (port number difference must be exactly 1000)
AndreasR
Elite
Posts: 755
Joined: Thu May 02, 2013 10:26 pm

Re: Everytime A diplomat is played, my game crashes.

Post by AndreasR »

sveinung wrote: I've currently gotten to a point were my web browser complains that "WebSocket connection to 'ws://localhost/civsocket' failed: Error during WebSocket handshake: Unexpected response code: 404" while http://localhost:7002/status says "Process status: OK". Any suggestion about what log or config file I should look at?
"WebSocket connection to ... failed" indicates that there was a connection error between the WebSocket client in your browser and the WebSocket server running in Freeciv-proxy. 404 indicates that the URL was incorrect. The WebSocket URL should be ws://localhost/civsocket/7002. My best guess is that the freeciv-web webapplication is not updated, or the nginx configuration. Pull the latest code from github, then build the different components in the order described here.

I have improved the status-freeciv-web.sh script to check for more things. Could you pull this from git and post the output? The output should look like this:

Code: Select all

Checking that Freeciv-web is running correctly... 


checking nginx on http://localhost
nginx OK!

--------------------------------
checking resin on http://localhost:8080/
resin OK!

--------------------------------
checking freeciv-proxy directly on http://localhost:7001/status
freeciv-proxy OK!

--------------------------------
checking freeciv-proxy through nginx on http://localhost/civsocket/7001/status
freeciv-proxy OK!

--------------------------------
testing WebSocket connection directly to Tornado
This should show "HTTP/1.1 101 Switching Protocols" and then timeout after 2 seconds.
HTTP/1.1 101 Switching Protocols

Upgrade: websocket

Connection: Upgrade

Sec-WebSocket-Accept: KXGdZMoi2440O31GaOAuKsZfThY=



testing WebSocket connection through nginx
This should show "HTTP/1.1 101 Switching Protocols" and then timeout after 2 seconds.
HTTP/1.1 101 Switching Protocols

Server: nginx/1.4.6 (Ubuntu)

Date: Tue, 09 Sep 2014 16:55:09 GMT

Connection: upgrade

Upgrade: websocket

Sec-WebSocket-Accept: KXGdZMoi2440O31GaOAuKsZfThY=




--------------------------------
 checking freeciv-web / publite2
freeciv-web OK!

--------------------------------
checking that webclient.min.js has been generated...
webclient.min.js is OK!

--------------------------------
checking that tileset has been generated...
tileset is OK!

--------------------------------
checking metaserver...
metaserver is OK!

--------------------------------
Check of Freeciv-web is done!
Also, could you please open the Javascript Console in your browser, and press Alt D as this will print some debug information to the console. This is what it looks like for me:

Code: Select all

Freeciv version: +Freeciv.Web.Devel-2.6 tracker.js:10
Browser useragent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36 tracker.js:10
jQuery version: 2.1.2-pre 995f70777ac6c0f988a44807ef1399e73937b2ee tracker.js:10
jQuery UI version: 1.11.1 tracker.js:10
simpleStorage version: 0.1.2 tracker.js:10
savegame count: undefined tracker.js:10
Touch device: false tracker.js:10
HTTP protocol: https: tracker.js:10
Network PING average (server): NaN ms. (Max: 0ms.) tracker.js:10
Network PING average (client): NaN ms.  (Max: 0ms.) tracker.js:10
mozDash support: false 
It would also be useful if you could start a new game in Google Chrome while running the developer tools.
Then go to "Network", and show me the output of the /civclientlauncher and /civsocket URLS there.

/civclientlauncher in Chrome. Note the response header called 'port' which is 6007. This will tell the client to connect to /civsocket/7007 using WebSockets, where nginx will proxy this request to a Freeciv-proxy server running on localhost:7007/civsocket, which will connect to a Freeciv C server on port 6007.
Image

/civsocket/7007 in Chrome
Image

Basically, this is why I like setting up the build environment automatically with Vagrant. It should be very easy. Perhaps you could try that again, maybe it is faster now?

I hope this helps!
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Everytime A diplomat is played, my game crashes.

Post by sveinung »

I have good news and bad news. The good news is that it works. The bad news is that I can't tell what change I did that fixed it. (I didn't check here first so I didn't know that the updated config files could be the solution)
AndreasR wrote:My best guess is that the freeciv-web webapplication is not updated, or the nginx configuration.
I touched both without testing between the steps. I suspect that deleting the old compiled JavaScript was the solution. I noticed that the compiled code had a different URL than in clinet.js. A text search for the code that would end up in "ws://" host name "/civsocket" being opened resulted in 3 files, all with compiled JavaScript. I therefore assumed they were fossils and deleted them. Since I updated Freeciv-web and replaced the nginx.conf (and nginx-https.conf) from yesterday with today's version before rebuilding I can't say for sure. Do you want me to test with the old config files?
AndreasR
Elite
Posts: 755
Joined: Thu May 02, 2013 10:26 pm

Re: Everytime A diplomat is played, my game crashes.

Post by AndreasR »

"good news, bad news" scared me a little there.. I'm glad that it's working for you now! :D

Do you think that we can improve the documentation somehow to make it easier for other people to get it setup correctly?

If you want to test with the old config files to help determine the cause of your previous issue, that would be helpful.
Post Reply