process_console_command or whatever you want to call it isn't thread safe, if you are executing it in your own thread that might be the problem.