This may sound like a noob question, because it is. I have tried for days to figure out what I am doing to make it crash, but I can't figure it out.
I have various objects that use CCActions. When the objects need to be removed from screen, I call [spriteObject stopAllActions]; I then release the actions. (I retain the actions in init, as I was trying to avoid this kind of crash).
The program randomly crashes at this line in CCScheduler:
[elt->currentTimer release];
The error message is that I am sending a message to a deallocated instance. But I can't figure out what gets deallocated when. I retain all the actions I create. I even tried running the program without ever releasing the actions, to see If that was the cause, but it still crashes.
Sometimes it crashes after 20minutes, sometimes after 2 minutes. It is pretty random.
I'm not sure what to put up because the code is pretty spread out.
Basically, I have a Sprite, which contains a "Strategy" object, which contains the CCAction that is running. At run time I create a "strategy" and pass it to the sprite which retains the strategy.
The sprites are not deallocated until the end of program execution.
Any ideas on how I can figure out what is being deallocated, where and why? I really can't figure it out. Not sure what information to put up here. :C
Cocos2d is currently not thread safe, and the api's are not expected to be called from other threads.
Related
I currently have a multiplayer game that players are starting to use memory editing to to cancel attack animation making the attack packets come-in faster or making the attacks a lot faster than normal.
Yes a better design would be ideal but that could take a while. I wanted to get a temporary fix that can be done quick.
The ideas:
Check time difference between the last attack packet ignore everything that is too fast. (for server)
Use EnumWindows check for window classes and stop the game if a known memory editor is detected. EnumWindows will be executed each time an attack is made. (for client)
Use ReadProcessMemory to read running processes and find signitures for known memory editors.
Well the question really is if any of the following could work and how it would be done:
Detour ReadProcessMemory or OpenProcess and exit when called? (though I think this wont work because these functions gets called by the memory editor not my game).
ReadProcessMemory on my self(game) and check the addresses that they are changing. Check if the values are not within the normal range then exit.
Any suggestions?
I know that it is futile to do this because cheaters that knows what their doing can still get around all this. But my game has only about 600 active players, I believe they are just somewhat scriptkiddies. I think this simple countermeasures should be enough for small games like mine. But of course, the design will be corrected.
Detour ReadProcessMemory or OpenProcess and exit when called?
These are not being called in your process so hooking them locally wouldn't do anything. You would need to hook every running process, which is not recommended.
ReadProcessMemory on my self(game) and check the addresses that they are changing. Check if the values are not within the normal range then exit.
You don't need to ReadProcessMemory, you're inside your own process. Just check the value normally.
You should calculate these values on the server if you don't want the client's to be able to manipulate them, then just replicate this info to the clients and overwrite them.
You can also add an antidebug library to your client to prevent the majority of people from manipulating your process. Here is a decent one
I'm maintaining an MFC application in some points it stop responding for 30 seconds , some times 1 minute or more. I'm supposed to fix that issue, I tried tracking the code[all methods in this class] and also the issue is still, I tried to pause debugging during this time and I got nothing as in this image
I want to know how to track the code that cause the application to stop responding
add watch variable for any separate thread event
increment each watch variable inside its thread
also very useful can be flag if the thread/event is executing (especially for events)
you must set this flag on enter
end clear before exit
visualize watch variables somehow.
either use some debug print inside your App.
or use separate Window
or even better separate App connected with any IPC method. (this will work even if your App UI hangs)
When the app hangs just see which variables are incrementing and which not
with flags you can determine exact what is hanging up on you ...
Good luck with debuging.
I'm working in a software built in C++ using C++ Builder which is freezing once a month.
I'm looking in the code but it is too big to find it.
The freezes make the UI gets all white. I tried to simulate this error with some proposital bad codes (null pointers, while(1) and this kind of stuff) but never got the same blank UI.
I ran a What's Hang when it's stopped but I got nothing with it.
Someone knows what can I do in the next time to get more informations which could help me find the reason of the freezing?
A blank (white) UI generally occurs when a UI paint message is queued but not processed. Simply blocking the message queue from processing new messages is not enough if you don't do something within the UI to trigger a repaint in the first place.
As for troubleshooting the original problem - you should be looking for any code in the main thread that runs longs loop without processing new messages, or long waits on waitable objects using WaitForSingleObject() or WaitForMultipleOBjects() instead of MsgWaitForMultipleObjects(), calls to TThread::WaitFor() for threads that do not terminate in a timely manner, etc.
It is hard to troubleshoot this kind of problem without knowing what steps the user performs to lead up to the frozen UI so you know what code to start looking at.
Should the same UIManagedDocument be open on both of my devices, and I save (using the following code):
[self.documentDatabase.managedObjectContext performBlockAndWait:^{
STNoteLabelCell *cell = (STNoteLabelCell *)[self.noteTableView cellForRowAtIndexPath:indexPath];
[cell setNote:newNote animated:YES];
}];
I am told that the UIManagedDocuments documentState is changed to UIDocumentStateSavingError then I get this error:
CoreData: error: (1) I/O error for database at /var/mobile/Applications/some-long-id/Documents/Read.dox/StoreContent.nosync/persistentStore. SQLite error code:1, 'cannot rollback - no transaction is active'
2013-05-14 16:30:09.062 myApp[11711:4d23] -[_PFUbiquityRecordImportOperation main](312): CoreData: Ubiquity: Threw trying to get the knowledge vector from the store: <NSSQLCore: 0x1e9e2680> (URL: file://localhost/var/mobile/Applications/some-long-id/Documents/Read.dox/StoreContent.nosync/persistentStore)
Does anybody know why this error happens?
A couple of things...
I think the saving the same document on two different devices is a red herring, as it will actually be working on a local copy of your database on each device - only the transaction logs get uploaded to iCloud.
Secondly, I may be confused, but I don't see anything in the above code snippet that indicates you are performing a save (unless it is triggered by one of those calls, or autosave happens).
What that code snippet does seem to be doing is:
On your database document's child MOC thread, run the following block
of code
And that block of code is doing purely UI related stuff,
nothing to actually do with the database? The only thing that might
be going out to the DB is cellForRowAtIndexPath - and this usually
would be expected to only be doing read operations, not something
that needs to save.
The only other thing.... if the above code does trigger a save - you might have an issue with performing that as a performBlockAndWait. The UIManagedDocument save routines do stuff asynchronously - but they need the run loop to execute before they actually get a chance to run the async part... So by blocking before continuing you may actually be preventing the actual save from being executed or something.
I'm guessing wildly here, but have seen enough with saving managed documents to know to be really careful with which thread things are actually being called from, and that after a save request has been made, to allow the run loop to have a chance to actually do it. To be fair, this has only ever been an issue with calling saveToURL: repeatedly within one method, or in a loop, in which case all the async parts of the saves get queued up and executed at the end, usually to great comical effect.
I am currently writing a game in C++ for Windows. The server counterpart creates two additional threads at the very start. One of them handles receiving new data, and the other handles movement calculation of the objects in the game. What I managed to find out is that the last thread function (called TickFunc) is the one that slows everything down. My music freezes, I can't open new tabs in my browser, everything is slow and freezes. Even if I comment everything within the TickFunc out (leaving an empty while loop that executes forever), it still freezes, but if I do not create that thread at all, it's fine. It seems as though it slows the system down regardless of the intensity of calculation performed within the TickFunc. I would really appreciate any hints concerning what may be causing this. Thank you.
Regards,
Neob91
Put a small delay inside your infinite loop.