The Castle Doctrine Forums

Discuss the massively-multiplayer home defense game.

You are not logged in.

#1 2014-02-22 09:24:52

StefanLindskog
Member
From: Oslo, Norway
Registered: 2014-02-22
Posts: 268

House login failed

Hi everyone, and sorry if this is an old topic. I searched but couldn't find anything that fit the bill.
Before I describe my problem I just want to say that I enjoy this game immensely. I'm a wife killing coward, but that's my style - in the game, not for real! O.o

Now, to my problem.

I had built myself a house as close to perfection as I can with my current skillset. A few minutes ago I did a few adjustments to it, proved that I could access the safe, and went to the menu to find a victim. When I went back to my house I got "House login failed" - and now my house is completely wiped. I'm left with a clean slate.
I don't mind losing to my own errors or the relentless stream of burglars that can have the skill, tools and luck to crack my house wide open and kill my family. This though, is really sad. I'm not blaming anyone, because I understand what a masterful creation this is - by just one man, mind you. Still... Is this a thing, or am I one of few who has lost their lovely and expert killer abode this way?

Jason. If you read this (I guess you don't have time for it - but if you do), is this a known bug? I'm afraid to put effort into recreating my wonderful house, because if I risk losing it to "House login failed" I couldn't take it. Please say it's rare. I love your game too much for this to be a show stopper for me. It would kill me (but not my wife - she's starting to silently hate this game tongue ).

If there's any chance of a rollback, I'd nerdgasm all over the place.

Best,

Stefan

Last edited by StefanLindskog (2014-02-22 09:55:35)


Current life: Unknown

Rotary toggle switches... Sooooo sexy.

Offline

#2 2014-02-22 09:48:55

RevealingGekco
Member
Registered: 2014-02-02
Posts: 65

Re: House login failed

Yikes, sorry to hear that.  I made some edits this morning too, but this didn't happen to me.  It sounds similar to the 'house check-in' error, which a temporary fix was put in for earlier.

Offline

#3 2014-02-22 09:54:21

StefanLindskog
Member
From: Oslo, Norway
Registered: 2014-02-22
Posts: 268

Re: House login failed

Thanks! It might very well have said "house check-in failed". I was on high WTF?!-mode, and could easily have misread it.


Current life: Unknown

Rotary toggle switches... Sooooo sexy.

Offline

#4 2014-02-22 10:10:15

MMaster
Member
Registered: 2014-02-12
Posts: 325

Re: House login failed

Hi, it looks like there is some problem on in the game. Take a look at this thread: http://thecastledoctrine.net/forums/vie … php?id=998
Jason is really sorry for that and he is working on the fix.


...

Offline

#5 2014-02-22 10:19:31

StefanLindskog
Member
From: Oslo, Norway
Registered: 2014-02-22
Posts: 268

Re: House login failed

Thank for the info MMaster. There are abolutely no hard feelings here. I know the industry and couldn't hold a grudge for bugs to save my life.

I'll probably need only a few hours to get the urge to play again, but damn... Minutes before it happened, I thought to myself: "Jeebus, what a house! I wonder what kind of beatings it will take.". You probably know the feeling. My first all steel house with so many snags and double bluffs it made my mother in law look merciful in comparison. smile


Current life: Unknown

Rotary toggle switches... Sooooo sexy.

Offline

#6 2014-02-22 12:32:52

StefanLindskog
Member
From: Oslo, Norway
Registered: 2014-02-22
Posts: 268

Re: House login failed

I'm going to post a Castlecraft link to my house in order to let you feel my loss - my bleeding mental wound! I'll reveal my house, but maybe something good will come of it. It'll force me to come up with new ideas - and that's always nice. Don't want to get stuck now, do we?


Current life: Unknown

Rotary toggle switches... Sooooo sexy.

Offline

#7 2014-02-22 13:28:57

StefanLindskog
Member
From: Oslo, Norway
Registered: 2014-02-22
Posts: 268

Re: House login failed

Ok. This is not a perfect copy, but it's damn close. Committing 600 squares to memory is something my brain only manage to do with 95 % success. All gone in a heartbeat.

The pain! tongue

EDIT: Castledraft link removed due to regret.

Last edited by StefanLindskog (2014-02-22 19:04:38)


Current life: Unknown

Rotary toggle switches... Sooooo sexy.

Offline

#8 2014-02-22 17:07:22

joshwithguitar
Member
Registered: 2013-07-28
Posts: 538

Re: House login failed

You will be able to extract an exact copy of your house to import to castedraft from your recordGame files. Click on "import" in castledraft and then "instructions" to see how. Sorry this is a bit late, but you'll know for next time!

Also, you should send your recordGame file to Jason in an email: jasonrohrer@fastmail.fm

Crashes like this are fairly rare now and Jason wants to know whenever they happen because they obviously have a big effect in a game like this.

Last edited by joshwithguitar (2014-02-22 17:10:31)

Offline

#9 2014-02-22 18:30:56

StefanLindskog
Member
From: Oslo, Norway
Registered: 2014-02-22
Posts: 268

Re: House login failed

Thank you Josh!
I will do that. Maybe some good will come of it. Fingers crossed!


Current life: Unknown

Rotary toggle switches... Sooooo sexy.

Offline

#10 2014-02-24 11:19:25

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: House login failed

Yeah, the hard part about fixing this stuff is really finding it...

These are so rare and mysterious at this point that sometimes it's hard to figure out what caused the problem.

In Stefan's case, it looks like his request to the server was cut off for some reason at the end of his robbery, which meant that the whole map wasn't submitted.

I have NO idea what's causing this.  I assumed that an HTTP request, if received by the server, was guaranteed to be a complete request and not cut off.  Maybe that's not the case.

I think I need to add something to the protocol to detect and deal with this.

Of course, it is SO rare that it's hard to even notice.

But when it happens to YOU, you notice it!

Offline

#11 2014-02-24 14:02:14

MMaster
Member
Registered: 2014-02-12
Posts: 325

Re: House login failed

jasonrohrer wrote:

Yeah, the hard part about fixing this stuff is really finding it...

These are so rare and mysterious at this point that sometimes it's hard to figure out what caused the problem.

In Stefan's case, it looks like his request to the server was cut off for some reason at the end of his robbery, which meant that the whole map wasn't submitted.

I have NO idea what's causing this.  I assumed that an HTTP request, if received by the server, was guaranteed to be a complete request and not cut off.  Maybe that's not the case.

I think I need to add something to the protocol to detect and deal with this.

Of course, it is SO rare that it's hard to even notice.

But when it happens to YOU, you notice it!

In case of HTTP the request is not complete in these cases:
- client lost connection at the exact time the request was just being transferred (in that case your PHP script is already running and just receives part of the request that came to the server even when connection was cut in the middle)
- broken proxy server implementation
- web server using some kind of chunking (in that case client would have to announce support for it too so that's probably not a case)
- and of course last option that you already know - modified/broken client

As you are working with PHP and don't have any control over the connection itself what you could do is mark the end of the request and on the server side check for that mark. Make client repeat the request several times by responding with EAGAIN or something like that or in case when the server does not respond at all. (see EDIT)
This should solve Stefan's issue. The issue with multiple LEAVE moves is however much harder to solve (find).

EDIT: Even better - add the Content-length header from the client and check it on server side. As that one is sent at the beginning of request you will always know if you have everything.

And with the multiple leave issue - it can be caused by some kind of queue that SDL does for keys and maybe the robberTriedToLeave function is called multiple times because of that. As that function is the only one that adds L to the move list and L is always last one you can simply check if last move is L and don't add another one if so.

Last edited by MMaster (2014-02-24 15:03:29)


...

Offline

#12 2014-02-25 13:52:13

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: House login failed

Yeah, fixed the multiple leave issue already.


Another player sent me recordings that confirm that their client was sending the full request (but that it got cut off before the server received the whole thing).

I'm already using Content-Length headers (these are POST requests, and I think they're pretty much required, right)?

So... that brings up the question of why PHP is accepting an HTTP request as complete that does not have POST data matching Content-Length!

Yeah, I just tested this, and PHP ignores Content-Length and lets the request through even if the length of the data does not match the length specified in the Content-Length header (like, if the connection is closed before all the data is sent).

Though I suppose that I could check the Content-Length and make sure it matches.  And this fix could happen server-side with no change to the client protocol.

And some client requests are GET requests, but these are protected from truncation because the full URL comes before the HTTP/1.0 marker in the protocol, so the request is totally invalid if the URL is cut off part way through.


Oh wait... on my servers, even totally incomplete HTTP requests (like "GET /" with nothing after it) are being processed.  So incomplete URLs are being sent through to server.php.   This is crazy.  Need to figure out how to block those for sure.

Offline

#13 2014-02-25 14:09:09

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: House login failed

Oh, this is kind of amazing:

GET /gameServer/server.php

This IS actually a valid HTTP request, by itself, because it matches the ancient HTTP 0.9 spec from 1991.  The server responds with no headers and just sends the requested document (or does the requested PHP action).

Apache ships supporting this 1991 compatibility mode.

Sadly, this also prevents Apache from detecting modern HTTP requests that might be cut off mid-URL.

Weird that the protocol was "appended" in this way so that you can't tell which version of the protocol you're using from character 0 of the request.

Though maybe this allows modern HTTP browsers to still talk to old 1991 servers just fine?

Offline

#14 2014-02-25 14:34:10

MMaster
Member
Registered: 2014-02-12
Posts: 325

Re: House login failed

Hm. I'm almost sure apache executes PHP before whole request is received so it doesn't know yet if all data will come. It is on the php script to check it.

You are right about the HTTP/0.9 mod_policy can be used to disable it / enforce other.

EDIT: You can also try to use $_SERVER[ "SERVER_PROTOCOL" ] to check the HTTP/1.0 or HTTP/1.1 string.

Last edited by MMaster (2014-02-25 14:38:39)


...

Offline

#15 2014-02-25 14:56:24

MMaster
Member
Registered: 2014-02-12
Posts: 325

Re: House login failed

jasonrohrer wrote:

Though maybe this allows modern HTTP browsers to still talk to old 1991 servers just fine?

I think it's both ways as even modern web servers don't have problem supporting HTTP/0.9 when they already support HTTP/1.0. It is quite usual to not make drastic changes to the protocols between versions. Yeah it is a problem when you encounter problem like this, but you can still tell if the request was for HTTP/0.9. And if your application is made only for HTTP/1.0+ then you can simply refuse to process the request. In case of static pages it doesn't really matter.


...

Offline

#16 2014-02-27 10:51:53

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: House login failed

Yes, I ended up checking SERVER_PROTOCOL and simply blocking HTTP/0.9 (because I can't tell if GET urls are complete or cut off... given that the client speaks HTTP/1.0, if the GET request looks like 0.9, it has likely been cut off anyway).

And then for POST requests, I check that CONTENT_LENGTH matches the actual length of the post body.

In either case, the server sleeps for 30 seconds before returning an error code, letting the client give up and retry (hopefully the full request will make it through on retry).

So far, a cut off POST has only been logged once since I put this check in place.  But that's one person saved from death!

Offline

#17 2014-02-27 12:58:16

MMaster
Member
Registered: 2014-02-12
Posts: 325

Re: House login failed

jasonrohrer wrote:

So far, a cut off POST has only been logged once since I put this check in place.  But that's one person saved from death!

That's awesome! wink

Thank you again for all of us!


...

Offline

Board footer

Powered by FluxBB 1.5.8