Callback Read timed out

Report bugs found in Poker Mavens
Post Reply
Tuck Fheman
Posts: 213
Joined: Tue Jul 04, 2017 6:44 am

Callback Read timed out

Post by Tuck Fheman »

This is not a bug report, I'm 99.99% sure this is something in my code or simply too much code ... but I have a question about the callback.php file since my code works fine 90% of the time and then once or twice a day we get this ...

Image

I've isolated this down to when it started in mid-March, and what this causes is for the code in one of the callback.php "cases" to run twice and thereby duplicate what we have the code doing.

There is quite a bit going on in our case "TourneyFinish": area, so I'm wondering if perhaps I've overdone it. Is there some sort of time limit on the callback where things need to finish by a certain amount of seconds?

I can post the code I have in this area if necessary, but it's pretty much the code I've pasted on the forum previously that reads the tourney results file, then it calculates points based off place finished, loops through entrants and puts the points into the Level field for the players, then adds +1 to the # of tourney's played in and stores that in the ERake field, then sends a message with a discord bot, then if it was a KO tourney returns the entry fee back to the winner of the tourney.

So like I said, there's a bunch going on in that one case and since it works fine 90% of the time I'm just wondering if at times it simply takes too long to process all of this due to the number of players in the tournament??? Because I see nothing wrong with the code (but I'm a n00b).

And if that could be the case, is there anyway around it?
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Callback Read timed out

Post by Kent Briggs »

Not sure if it took too long or never was able to make a connection at all. I'll have to check on the default read timeout but I image it would have to be at least 30 seconds. If your code is taking more than a second or two to run then something is not right there.
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Callback Read timed out

Post by Kent Briggs »

Yeah, I just checked and the read timeout is set for 30 seconds. Your code should be done way before then. You might be able to start a thread in PHP (never tried that myself) and then return immediately, letting your code continue on by itself.
Tuck Fheman
Posts: 213
Joined: Tue Jul 04, 2017 6:44 am

Re: Callback Read timed out

Post by Tuck Fheman »

Kent,

When does case "TourneyFinish": start?

Does that event fire off immediately when a tournament finishes OR does it fire off when the tournaments "Reset seconds" ends?

I'm thinking this may be what's causing my issue. My code is running in the TourneyFinish event and it's trying to read the latest tourney results file and the tourneys are set to Reset after 2 minutes, which I assume is when the results file is written to disk. So I'm just trying to track down if this is why I'm having this issue is because the event is firing off and I'm trying to read a text file that doesn't exist yet.
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Callback Read timed out

Post by Kent Briggs »

Tuck Fheman wrote:When does case "TourneyFinish": start? Does that event fire off immediately when a tournament finishes OR does it fire off when the tournaments "Reset seconds" ends?
As soon as it finishes, before the reset period.
Tuck Fheman
Posts: 213
Joined: Tue Jul 04, 2017 6:44 am

Re: Callback Read timed out

Post by Tuck Fheman »

Right now I'm leaning towards this was all caused by the "sleep()" line in my code. After testing various other solutions, none of which worked, I commented the sleep() line out and have not seen this issue again for the past 3 days.
Post Reply