Any idea why routines stop?

20 views
Skip to first unread message

Nicolas

unread,
Dec 1, 2014, 6:27:52 PM12/1/14
to ape-p...@googlegroups.com
Hi all,

I run a platform to play one-on-one games online. Most games are played human vs AI (artificial intelligence) and for online games (rated), the AI is hosted on the APE server to prevent cheating.

Of course, having AI on the server is not recommended because it is CPU intensive. However, this should not really be a problem as when I have more players, they will play against each other and there is therefore no need for an AI at peak times.

Well, in reality, I have an issue and it is not easy to see where it is.

The symptoms are: 

The AI stops abruptly without giving any error. To be accurate, it is not only the AI, one or two other functions related to the refereeing of games also stop abruptly from time to time. 

By stopping abruptly I mean the function stops without being completed. And it does not tell anyone.

I noted that this only occurs when:

- lots of users are connected at the same time (so lots of AIs working at the same time).
- the server has run for a few days or weeks (the APE memory increases slightly over time, but it never goes over 110-120MB).

Please note the machine is more powerful than needed and that issues are not related to any other activity on the machine. So the problem lies within APE (APE itself or my code).

Have you got any clue why APE stops functions abruptly? Or how I could find the issue?

Thanks for your time!

Nicolas.

PS: my AI routines take only a tiny fraction of seconds (the AIs can play 1,000 moves per second).

peter.r...@verpeteren.nl

unread,
Dec 5, 2014, 4:13:46 PM12/5/14
to ape-p...@googlegroups.com
Hai


I guess that an object becomes undefined, and you are still doing
something on that object.

This happens often if there is a mysql timeout.

var sql = new Ape.MySQL("ip:port", "user", "password",
"database");
sql.onConnect = function() {
Ape.log('Connected to mysql server');
}
// fast forward two days, depending on your mysql setup
// the connection behind the sql object is closed by now

sql.query("SELECT * FROM table", function(res, errorNo) {
Ape.log( "WTF" );
});

I've been bitten by this mysql timeout that's why I remember (search
the newsgroup). But it could also happen on other things.
e.g.

Ape = null;
Ape.log( "WTF" );

Try to pin down the problem, by wrapping them up in try/catch blocks


Peter

Nicolas schreef op 2014-12-02 00:27:
> --
> --
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To post to this group, send email to ape-p...@googlegroups.com
> To unsubscribe from this group, send email to
> ape-project...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ape-project?hl=en [1]
> ---
> APE Project (Ajax Push Engine)
> Official website : http://www.ape-project.org/ [2]
> Git Hub : http://github.com/APE-Project/ [3]
>
> ---
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to ape-project...@googlegroups.com [4].
> For more options, visit https://groups.google.com/d/optout [5].
>
>
> Links:
> ------
> [1] http://groups.google.com/group/ape-project?hl=en
> [2] http://www.ape-project.org/
> [3] http://github.com/APE-Project/
> [4] mailto:ape-project...@googlegroups.com
> [5] https://groups.google.com/d/optout

Nicolas

unread,
Dec 5, 2014, 5:17:27 PM12/5/14
to ape-p...@googlegroups.com, peter.r...@verpeteren.nl
Thanks Peter,

I ping Mysql every minute so this is not the issue I believe. I'll keep your suggestion in any case, although I am not sure how to use it.

My guess was that all my problems were memory-related.

But your explanation regarding the maximum size of arrays see my previous thread) makes me wonder.

If APE has a (low) limit in the number of arrays it can handle, then it must clearly say it and indeed I get out of memory errors on screen when I test array creation.

But this is not coherent with my other problem (the one of this thread). The function termination is intermittent (but more and more frequent as times goes by).

So in one case, the crash is immediate and will repeat if I try again. And in the other case, the crashes are intermittent.

This may mean that there are two different memory issues.

Thanks again.


Reply all
Reply to author
Forward
0 new messages