-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access violations #80
Comments
A call stack and locals/autos window would be very much useful for the first image. Details are important. |
Actually, the first type of errors happens randomly. I mean sometimes right after when I logged in to the game, sometimes during the game, there is no specific correlation between the events when the error occurs, as far as I see. I don't not have detailed info about the errors right now, but I will take rigorous notes when these types of errors occur in the future. |
Without a call stack at the very least, it's impossible to say anything concrete about the first one. What we can see from the screenshot is the following:
As __VertexTransformed is used often, without a call stack, we don't know which use case this was and thus can't further determine what is using an uninitialised pointer, nor why. It's very important you always include this information with crashes. I'm not sure why they're even hidden from your IDE; these windows are always useful while debugging, which is why they should be enabled by default (I haven't used VS2017 though, but they've always shown up by default in all versions of VS up to 2015 at least). |
Okay. I actually know why the second one's happening, as it's something I've fixed before in another project.
This is failing, which in turn is causing the following code to blindly run and crash. It fails when the device is inaccessible, which tends to happen when you alt+tab or ctrl+alt+del. What you'll find after implementing error handling these Lock() calls (not just this one) is certain resources will be lost because they're not managed by DirectX (and we don't handle it ourselves), so they'll need to be moved into D3DPOOL_MANAGED so that DirectX can restore them automatically for us. Regarding the first one, I would move up the callstack to CGameProcedure::Tick() and check the locals there. It seems to be an issue with the packet handling, but it's not clear why. I don't recall how networking works in this project, so it may possibly be a race condition (packet being retrieved / removed from the queue while another is being added) but I couldn't say for certain. |
std::deque isn't thread-safe. We should make it thread-safe with synchronization objects? |
Right, but which threads are we talking about? Because the client operates in a primarily single-threaded manner. Are we talking about packets? These are pooled in the main thread and handled on each frame (again, in the main thread). |
So I don't understand how a race condition can occur if the queue is handled in one thread. Sounds to me like stacko. |
Okay. Had to sift through the screenshots above because I didn't even recall seeing one about packets specifically, but what is there is fairly vague. Looking at this project's source base, I can tell you one thing for certain: all packet logic is handled in the main thread. We handle receive requests via windows messaging (WndProcMain gets called).
Receive(), of course, calls ReceiveProcess() which ultimately appends the packet to the queue:
The message pump is called via LocalInput::Tick() (... this is terrible, but ok), which polls events from SDL:
This is called via CGameProcedure::Tick().
Which is ultimately called by the main game thread:
The packet being read from the queue is also handled in CGameProcedure::Tick():
So it's not a race condition; these are handled pretty obviously in the same thread. So what is causing it? Well, likely something being modified when the packet itself is handled. The screenshot above is terrible, so I can't say for certain, however the only other likely option is s_pSocket itself. So what to do about it? I'd swap() the queue over to a localised queue so s_pSocket can be disregarded while actually processing the packets. That should cut that potential issue out. As for whether or not that's actually the issue, I'm not sure. There's not enough data to go off to be sure. |
The packet-related one is an overrun which was fixed by f5e6dc2. The others are all separate issues so it's difficult to say much on them, but one issue for the various separate issues isn't terribly helpful, so I'm closing this one and opening up separate issues for the other 2 crashes: #147 and #148 |
Sorry for the Turkish VS2017.
In the first image it says that:
"at 0x017... on KnightOnline.exe a special case thas occurred.
0xC000... : Write access violation at position 0xCCC... "
And in the second image, it says that:
"Exception occurred: read access violation.
CN3UIWndBase::m_sRecoveryJobInfo.pItemSource is nullptr."
I often face with the errors in the first image, and they generally happen at some specific lines of code.
The text was updated successfully, but these errors were encountered: