Wake up early this morning so I setup the bot to farm something and go back to sleep.
When I am ready for work, I found the bot has crashed. Curious about what caused it, I
did a trace and found it crashed inside the javascript engine, some assertion about
something variable in the stack frame that should be NULL but is not.
A bit more digging around the code, I found the javascript stock frame is actually
created on local stock. The global context frame is temporarily replaced by it, and
restored back upon execution exit.
Now it is clear. If something happends that prevented the restore of the original stock
frame, the global context frame will be pointed to non-exist space. That something is
usually exceptions raised upon native code (C++ code). It could be that because network
either on Blizzard's side or my side, connection is closed and native C++ raised
exception. I am catching the exception but was too far out thus the javascript did not
have a chance to clean up it's stock.
A good solution will be use the try{}finally{} replacement trick I mentioned before in
my blog to make sure the stock frame is restored upon function exit.
Gutted
3 weeks ago
No comments:
Post a Comment