Vague world crash
Moderators: Community Managers, Developers
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Vague world crash
So here's my first observation; None of the existing thread starters have Loggers. Yours does. The crash is in a memcpy, which we've seen dozens of times when LogWrite freaks out. There probably is no stack for this crashing thread since the thread just started up. I will comment these Loggers out and run the server for a while. If it's stable again, it's back to you to figure out why.
Code: Select all
/**
* @brief This is the thread function for the chunk regen tick thread.
*
* @author Ratief
* @date 18 Aug 2015
*/
void ChunkRegenThread(void *data) {
timem_t start_time = 0;
timem_t end_time = 0;
timem_t diff_time = 0;
ChunkServer *chunk = (ChunkServer *)data;
// A bit of logging
LogTrace(LOG_CHUNK, 1, "Starting regen thread for chunk %s.", chunk->GetChunkDisplayName());
// Set that we are running
chunk->regen_thread_active = true;
while (chunk->regen_thread_running) {
// Get the current microtime
start_time = TimeMS();
chunk->ProcessRegen();
// Get the end time
end_time = TimeMS();
// Sleep for the appropriate time
diff_time = end_time-start_time;
SleepMS(REGEN_TICK_INTERVAL-diff_time);
}
// A bit of logging
LogTrace(LOG_CHUNK, 1, "Exiting regen thread for chunk %s.", chunk->GetChunkDisplayName());
// Set that we are NOT running
chunk->regen_thread_active = false;
}
Re: Vague world crash
Great observation! I'm thinking about committing a check to make sure that chunk isn't NULL. Sadly I don't know of any way to verify that it is a valid chunk object though. However, I don't see how it could be anything except a valid chunk object unless the compiler is doing something really strange. I'm basically passing 'this', but in such a way that the compiler doesn't complain. You can't pass 'this' directly to a C function, so I have an intermediate pointer to it and pass that.
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Vague world crash
Right, I dismissed the invalid chunk argument because I don't think we should even be in here without one, though we've been hit with "timing issues" thanks to the Stupid Pointers problem. Still, probably not a bad idea to check it regardless.
Re: Vague world crash
I've been trying to crash my server with various character creations. I've tried creating a character in IoD while it is running (so the thread was active already). This is what I normally do. I have also tried creating a character in a home town when that chunk is down (so the thread is created as soon as the character is created). That didn't seem to cause a crash either.
I have also tried rifting all over the place, so far that hasn't caused a crash either.
I have also tried rifting all over the place, so far that hasn't caused a crash either.
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Vague world crash
2 days without crashing with those Log lines commented out, I will add them back in now and run over the weekend. If they re-appear, then we are not to put logging inside a thread startup - no matter what common sense dictates.
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Vague world crash
24h without a crash after putting the LogTrace lines back in, and as long as no one broke my statistics counters again, it looks like we have had over 40 connections since last restart. I'll give it the rest of the weekend before calling this one "a solved mystery".