• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Read access violation

Crevasse

惡名昭彰
Joined
Jan 13, 2017
Messages
133
Solutions
15
Reaction score
85
Location
Washington, D.C.
Hello,

Recently running into an issue where my server (OTX3) closes for no reason. Sometimes it happens after a few minutes, sometimes after a few hours. I have been working on the project for a couple years, and have never had this issue before. I attached the MSVS 15 debugger to the tfs.exe and got the following output when the server crashed:

First, it says it can't find the PDB file for all the dlls (not sure if this is related or not):
Code:
'theforgottenserver.exe' (Win32): Loaded 'E:\Open Tibia\OTX\theforgottenserver.exe'. Symbols loaded.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'E:\Open Tibia\OTX\libmysql.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\mswsock.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\secur32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\sspicli.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\WRusr.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\psapi.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\msimg32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\wldp.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\NapiNSP.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\pnrpnsp.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\wshbth.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\nlaapi.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\IPHLPAPI.DLL'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\dnsapi.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\winrnr.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\rasadhlp.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\FWPUCLNT.DLL'. Cannot find or open the PDB file.
'theforgottenserver.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. Cannot find or open the PDB file.
The thread 0x3f24 has exited with code 0 (0x0).

Then, the output fills up with this exception being thrown:
Code:
Exception thrown at 0x00007FFEDD69D759 (KernelBase.dll) in theforgottenserver.exe: 0xE24C4A02.

There are hundreds of lines of this same exact output, until finally it crashes with this:
Code:
Exception thrown at 0x00007FF73994393F in theforgottenserver.exe: 0xC0000005: Access violation reading location 0x0000000000000010.
Unhandled exception thrown: read access violation.
this was nullptr.

The break that it shows is line 45 of my tile.cpp, which is the line 3 in this snippet: (I've never touched tile.cpp):
C++:
bool Tile::hasProperty(ITEMPROPERTY prop) const
{
    if (ground && ground->hasProperty(prop)) {
        return true;
    }

    if (const TileItemVector* items = getItemList()) {
        for (const Item* item : *items) {
            if (item->hasProperty(prop)) {
                return true;
            }
        }
    }
    return false;
}

I've searched and no one has reported this exact issue before, this goes beyond my knowledge of C++ so any help in the right direction would be greatly appreciated.

Thanks!
 
i am not good at 1.2 but i think because ground doesn't have hasproperty funcation so you have to use item instead of ground between the ground gives a null value so you have to define a variable if value == null then return 0 . and use 0 value instead of null because pointer can't be null.
 
Back
Top